Skip to content

Commit

Permalink
Adding Base Image for Papermill Docker (#437)
Browse files Browse the repository at this point in the history
* adding docker for papermill

---------

Co-authored-by: bshifaw <[email protected]>
  • Loading branch information
bshifaw and bshifaw authored Feb 26, 2024
1 parent d131705 commit 3db650d
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docker/lr-papermill-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 12 additions & 0 deletions docker/lr-papermill-base/Makefile
Original file line number Diff line number Diff line change
@@ -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)
23 changes: 23 additions & 0 deletions docker/lr-papermill-base/environment.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3db650d

Please sign in to comment.