-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from umccr/docker_update
docker: use multi-stage build
- Loading branch information
Showing
3 changed files
with
36 additions
and
3,551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
* | ||
!conda | ||
!conda/env/lock/dracarys-linux-64.lock | ||
!.dockerignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,41 @@ | ||
FROM condaforge/mambaforge:22.9.0-2 as conda | ||
LABEL maintainer="https://github.com/pdiakumis" | ||
FROM ubuntu:20.04 | ||
LABEL org.opencontainers.image.authors="[email protected]" \ | ||
org.opencontainers.image.description="Dracarys Workflow Output Tidier" \ | ||
org.opencontainers.image.source="https://github.com/umccr/dracarys" \ | ||
org.opencontainers.image.url="https://github.com/umccr/dracarys" \ | ||
org.opencontainers.image.documentation="https://umccr.github.io/dracarys" \ | ||
org.opencontainers.image.licenses="MIT" | ||
|
||
# install conda-lock | ||
RUN mamba config \ | ||
--set always_yes yes \ | ||
--set always_copy yes && \ | ||
mamba install \ | ||
-c conda-forge \ | ||
-c nodefaults \ | ||
conda-lock && \ | ||
mamba clean --all --force-pkgs-dirs | ||
ARG MINIF="miniforge" | ||
ARG MINIF_VERSION="24.3.0-0" | ||
ARG MINIF_URL="https://github.com/conda-forge/${MINIF}/releases/download/${MINIF_VERSION}/Miniforge3-${MINIF_VERSION}-Linux-x86_64.sh" | ||
|
||
# install core pkgs, miniforge | ||
RUN apt-get update && \ | ||
apt-get install --yes --no-install-recommends \ | ||
bash bzip2 curl less wget zip ca-certificates && \ | ||
apt-get clean && \ | ||
curl --silent -L "${MINIF_URL}" -o "${MINIF}.sh" && \ | ||
/bin/bash "${MINIF}.sh" -b -p "/opt/${MINIF}/" && \ | ||
rm "${MINIF}.sh" | ||
|
||
# create conda env | ||
ENV PATH="/opt/${MINIF}/bin:$PATH" | ||
ARG CONDA_ENV_DIR="/home/conda_envs" | ||
ARG DRACARYS_LOCK="dracarys-linux-64.lock" | ||
ARG ENV_NAME="dracarys_env" | ||
COPY ./conda/env/lock/${DRACARYS_LOCK} . | ||
RUN conda-lock install --name ${ENV_NAME} ${DRACARYS_LOCK} && \ | ||
mamba clean --all --force-pkgs-dirs | ||
COPY "./conda/env/lock/${DRACARYS_LOCK}" "${CONDA_ENV_DIR}/" | ||
RUN conda create -n "dracarys_env" --file "${CONDA_ENV_DIR}/${DRACARYS_LOCK}" | ||
RUN conda clean --all --force-pkgs-dirs --yes | ||
|
||
# Now copy env to smaller image | ||
FROM quay.io/bioconda/base-glibc-debian-bash:3.1 | ||
|
||
COPY --from=0 "/opt/miniforge/envs/" "/opt/miniforge/envs/" | ||
|
||
ARG MAMBA_PREFIX="/opt/conda" | ||
ENV PATH="${MAMBA_PREFIX}/envs/${ENV_NAME}/bin:${PATH}" | ||
ENV CONDA_PREFIX="${MAMBA_PREFIX}/envs/${ENV_NAME}" | ||
# env is activated by default | ||
ARG MINIF="miniforge" | ||
ARG CONDA_ENV_NAME="dracarys_env" | ||
ENV PATH="/opt/${MINIF}/envs/${CONDA_ENV_NAME}/bin:${PATH}" | ||
ENV CONDA_PREFIX="/opt/${MINIF}/envs/${CONDA_ENV_NAME}" | ||
|
||
CMD [ "dracarys.R" ] |
Oops, something went wrong.