-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
75 lines (62 loc) · 2.78 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Dockerfile for building a Babel image.
# Use the RENCI Python image to make it easier to work with other
# RENCI Docker packages and to make sure we have an up to date image.
# (https://github.com/TranslatorSRI/RENCI-Python-image)
# FROM renciorg/renci-python-image:latest
#
# This is still at Python 3.9, so I'm going to use Python Latest, which
# should give us a Debian with Python 3.12+.
FROM python:latest
# Configuration options:
# - ${ROOT} is where Babel source code will be copied.
ARG ROOT=/code/babel
# - ${CORES} is the default number of cores to use.
ARG CORES=5
# Upgrade system files.
RUN apt update
RUN apt -y upgrade
# Install or upgrade some prerequisite packages.
RUN apt install -y python3-venv
RUN apt install -y gcc
RUN apt install -y git
RUN pip3 install --upgrade pip
# The following packages are useful in debugging runs
# of this software on a Kubernetes cluster, but can
# be removed if not needed.
RUN apt-get install -y htop
RUN apt-get install -y screen
RUN apt-get install -y vim
RUN apt-get install -y rsync
RUN apt-get install -y jq
# Create a non-root-user.
RUN adduser --home ${ROOT} --uid 1000 nru
# Copy directory into Docker.
COPY --chown=nru . ${ROOT}
# We can download some source files that Babel would otherwise need to download
# later. This means that this Docker will need to be rebuilt whenever these files
# change. They can be commented out if you would like the Docker to download these
# files when it is started.
#ADD --chown=runner https://ftp.ncbi.nih.gov/gene/DATA/gene2ensembl.gz babel_downloads/NCBIGene/gene2ensembl.gz
#ADD --chown=runner https://ftp.ncbi.nih.gov/gene/DATA/gene_info.gz babel_downloads/NCBIGene/gene_info.gz
#ADD --chown=runner https://ftp.ncbi.nih.gov/gene/DATA/gene_orthologs.gz babel_downloads/NCBIGene/gene_orthologs.gz
#ADD --chown=runner https://ftp.ncbi.nih.gov/gene/DATA/gene_refseq_uniprotkb_collab.gz babel_downloads/NCBIGene/gene_refseq_uniprotkb_collab.gz
#ADD --chown=runner https://ftp.ncbi.nih.gov/gene/DATA/mim2gene_medgen babel_downloads/NCBIGene/mim2gene_medgen
#ADD --chown=runner https://ftp.ncbi.nlm.nih.gov/pubchem/Compound/Extras/CID-SMILES.gz babel_downloads/PUBCHEM.COMPOUND/CID-SMILES.gz
# RENCI Python Image creates a `nru` (non-root user)
# for running code.
RUN mkdir -p ${ROOT}
WORKDIR ${ROOT}
USER nru
# The RENCI Python Image doesn't create a home directory,
# which is needed by Snakemake. So we make one ourselves.
RUN mkdir ${ROOT}/home
ENV HOME=${ROOT}/home
# Create and activate a local Python venv
ENV VIRTUAL_ENV=${ROOT}/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
# Install requirements from the lockfile.
# RUN pip3 install -r requirements.lock
RUN pip3 install -r requirements.txt
# Our default entrypoint is to start the Babel run.
ENTRYPOINT bash -c 'snakemake --cores ${CORES}'