-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile.custom_deployment
More file actions
170 lines (150 loc) · 4.93 KB
/
Dockerfile.custom_deployment
File metadata and controls
170 lines (150 loc) · 4.93 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# syntax=docker/dockerfile:1.4
FROM python:3.12-slim@sha256:bae1a061b657f403aaacb1069a7f67d91f7ef5725ab17ca36abc5f1b2797ff92 AS base
WORKDIR /app
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update -qq && \
apt-get install -yq --no-install-recommends \
git \
openssh-client \
wget \
gpg \
software-properties-common \
build-essential && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py312_25.3.1-1-Linux-x86_64.sh -O ~/miniconda.sh && \
chmod +x ~/miniconda.sh && \
bash ~/miniconda.sh -b -p /app/miniconda && \
rm ~/miniconda.sh && \
/app/miniconda/bin/conda init bash
# Set environment variables to point to conda environment
ENV VIRTUAL_ENV="/app/miniconda/bin"
ENV PATH="/app/miniconda/bin:$PATH"
ENV PYTHONPATH="/app/miniconda/lib/python3.12/site-packages:${PYTHONPATH:-}"
# Install uv & mamba
RUN --mount=type=cache,target=/root/.cache/pip \
pip3 install --no-cache-dir uv==0.5.21
RUN --mount=type=cache,target=/app/miniconda/pkgs \
conda install -c conda-forge mamba -y
# Install R and kernels in the crow_env environment
RUN --mount=type=cache,target=/app/miniconda/pkgs \
mamba install -c conda-forge -y \
r-base=4.3.3 \
r-recommended=4.3 \
r-irkernel=1.3.2 \
r-factominer=2.11 \
r-rcolorbrewer=1.1_3 \
r-devtools=2.4.5 \
r-broom=1.0.7 \
r-data.table=1.15.4 \
r-enrichr=3.2 \
r-factoextra=1.0.7 \
r-ggnewscale=0.5.0 \
r-ggrepel=0.9.6 \
r-ggpubr=0.6.0 \
r-ggvenn=0.1.10 \
r-janitor=2.2.1 \
r-multcomp=1.4_26 \
r-matrix=1.6_5 \
r-pheatmap=1.0.12 \
r-tidyverse=2.0.0 \
r-readxl=1.4.3 \
r-reshape=0.8.9 \
r-rstatix=0.7.2 \
r-viridis=0.6.5 \
udocker=1.3.17 \
imbalanced-learn=0.13.0 \
ipykernel=6.29.5 \
sqlite=3.47.2 \
anndata=0.11.1 \
biopython=1.84 \
datasets \
ete3=3.1.3 \
fcsparser=0.2.8 \
keras=3.7.0 \
jupyter=1.0.0 \
matplotlib=3.10.0 \
matplotlib-venn=1.1.1 \
nbconvert=7.16.4 \
numpy=1.26.4 \
optuna=4.1.0 \
openpyxl=3.1.5 \
pandas=2.2.3 \
plotly=5.24.1 \
rpy2=3.5.11 \
scipy=1.14.1 \
scanpy=1.10.4 \
seaborn=0.13.2 \
scikit-learn=1.6.0 \
statsmodels=0.14.4 \
umap-learn=0.5.7
RUN --mount=type=cache,target=/app/miniconda/pkgs \
python -m ipykernel install --user --name python3 --display-name "Python 3 (ipykernel)"
RUN --mount=type=cache,target=/app/miniconda/pkgs \
R -e 'IRkernel::installspec(name = "R", displayname = "R (4.3.3)")'
RUN --mount=type=cache,target=/app/miniconda/pkgs \
mamba install -c conda-forge -c bioconda -y \
biokit=0.5.0 \
gseapy=1.1.4 \
blast=2.16.0 \
clipkit=2.3.0 \
clustalo=1.2.4 \
fastqc=0.12.1 \
iqtree=2.3.6 \
mafft=7.526 \
metaeuk=7.bba0d80 \
mygene=3.2.2 \
perl=5.32.1 \
phykit=2.0.1 \
pydeseq2=0.4.12 \
spades=4.0.0 \
trim-galore=0.6.10 \
bioconductor-enhancedvolcano=1.20.0 \
bioconductor-deseq2=1.42.0 \
bioconductor-clusterprofiler=4.10.0 \
bioconductor-org.hs.eg.db=3.18.0 \
bioconductor-genomicranges=1.54.1 \
bioconductor-summarizedexperiment=1.32.0 \
bioconductor-apeglm=1.24.0 \
bioconductor-flowcore=2.14.0 \
bioconductor-flowmeans=1.62.0
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
RUN mamba clean -all -y && \
rm -rf /app/miniconda/pkgs/* && \
find /app/miniconda \( -type d -name __pycache__ -o -type d -name tests -o -type d -name '*.tests' -o -type d -name 'test' \) -exec rm -rf {} + && \
find /app/miniconda -type f -name '*.a' -delete && \
find /app/miniconda -type f -name '*.js.map' -delete
FROM base AS builder
ARG MODULE_NAME
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update -qq && \
apt-get install -yq --no-install-recommends \
build-essential && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ENV VIRTUAL_ENV="/app/miniconda/bin"
ENV PATH="/app/miniconda/bin:$PATH"
# Now copy application code (this will change frequently)
COPY ./${MODULE_NAME} /app/${MODULE_NAME}
RUN mkdir -p /app/scripts
COPY ./scripts/run_crow_job.py /app/scripts/
# Install application dependencies (this will only rerun when code changes)
WORKDIR /app/${MODULE_NAME}
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=cache,target=/app/miniconda/pkgs \
if [ -f "pyproject.toml" ]; then \
uv pip install --system -e .; \
elif [ -f "requirements.txt" ]; then \
uv pip install --system -r requirements.txt; \
else \
echo "No pyproject.toml or requirements.txt found" && exit 1; \
fi
RUN find /app -type l -delete && \
rm -rf /app/.git
FROM base AS runtime
COPY --from=builder /app/ /app/
ENV VIRTUAL_ENV="/app/miniconda/bin"
ENV PATH="/app/miniconda/bin:$PATH"
ENV PYTHONPATH="/app/miniconda/lib/python3.12/site-packages:${PYTHONPATH:-}"
CMD ["python", "scripts/run_crow_job.py"]