diff --git a/docker/lr-papermill-base/Dockerfile b/docker/lr-papermill-base/Dockerfile new file mode 100644 index 000000000..dc91b7924 --- /dev/null +++ b/docker/lr-papermill-base/Dockerfile @@ -0,0 +1,45 @@ +############### stage 0 +FROM continuumio/miniconda3 AS build +ARG PKM='conda' +ARG CONDA_ENV_NAME='lr-papermill-base' +ARG INSTALL_CMD="${PKM} env create -n ${CONDA_ENV_NAME}" +ARG CLEAN_CMD="${PKM} clean --all --yes" + +# conda-pack is needed to create a standalone conda environment that can be moved between systems. +# It allows you to package all the dependencies of this project into a single tarball. +# This tarball can then be unpacked on any system that has conda installed, +# allowing you to quickly and easily recreate your environment without transfering over +# the large conda cache, which can be several GB in size. This is especially useful for +# saving space on a docker image. +# Install conda-pack: +RUN ${PKM} update -y -n base conda && \ + ${PKM} install -y -c conda-forge conda-pack libmamba && \ + ${PKM} config --set solver libmamba && \ + ${CLEAN_CMD} + +# Copy environment.yml to the container: +COPY environment.yml . +RUN ${INSTALL_CMD} \ + --file environment.yml && \ + ${CLEAN_CMD} + + +# Use conda-pack to create a standalone enviornment +# in /venv: +RUN conda-pack \ + -n ${CONDA_ENV_NAME} \ + -o /tmp/env.tar && \ + mkdir /venv && cd /venv && tar xf /tmp/env.tar && \ + rm /tmp/env.tar +# We've put venv in same path it'll be in final image, +# so now fix up paths: +RUN /venv/bin/conda-unpack + +RUN ${CLEAN_CMD} + +############### stage 1 +FROM ubuntu:20.04 AS runtime +# Copy /venv from the previous stage: +COPY --from=build /venv /venv +ENV VIRTUAL_ENV=/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" diff --git a/docker/lr-papermill-base/Makefile b/docker/lr-papermill-base/Makefile new file mode 100644 index 000000000..8d0c3a094 --- /dev/null +++ b/docker/lr-papermill-base/Makefile @@ -0,0 +1,12 @@ +VERSION = 2.5.0 +TAG1 = us.gcr.io/broad-dsp-lrma/lr-papermill-base:$(VERSION) +TAG2 = us.gcr.io/broad-dsp-lrma/lr-papermill-base:latest + +all: build + +build: + docker build -t $(TAG1) -t $(TAG2) . + +push: + docker push $(TAG1) + docker push $(TAG2) diff --git a/docker/lr-papermill-base/environment.yml b/docker/lr-papermill-base/environment.yml new file mode 100644 index 000000000..bf4ced97c --- /dev/null +++ b/docker/lr-papermill-base/environment.yml @@ -0,0 +1,23 @@ +name: lr-papermill-base-base + +channels: + - bioconda + - defaults + - conda-forge + - r + +dependencies: + - tree=2.1.1 + - python=3.11.6 + - jupyter=1.0.0 + - papermill=2.4.0 + - pandas=2.1.1 + - numpy=1.26.0 + - scipy=1.11.3 + - matplotlib=3.8.0 + - seaborn=0.12.2 + - r-base=4.1.3 + - r-essentials=4.1.0 + - r-ggplot2=3.4.2 + - r-dplyr=1.1.2 + - r-ggbeeswarm=0.7.2