-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_v0.7
280 lines (235 loc) · 9.49 KB
/
Dockerfile_v0.7
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# This Dockerfile is written with the help of the output of Neurodocker
# Dockerfile_v0.7 introduces the following changes:
# 1. Use Python 3.11 instead of Python 3.8
# - Deepbet is now going to work
# 2. Update FSL from version 6.0.1 to 6.0.5
# - Also fixes crashing FSL installation process
# 3. Rework installation of PUMI's required packages
# - Fix conda package installation problems
# - Install needed software like gcc
# - Be more specific about package versions
# - Try newer version of scikit-learn (1.3.2), because current version won't work with Python versions >= 3.12
# -------------------------------------------------
FROM debian:buster-slim
ARG DEBIAN_FRONTEND=noninteractive
LABEL maintainer="Tamas Spisak <tamas.spisak@uk-essen.de>"
ARG NB_USER="pumi"
ARG NB_UID="1000"
ARG NB_GID="100"
USER root
# [ROOT] SET UP CONDA:
ENV CONDA_DIR="/opt/miniconda-latest" \
PATH="/opt/miniconda-latest/bin:$PATH"
RUN apt-get update --yes && apt-get upgrade --yes && apt-get install --yes --no-install-recommends \
git \
bzip2 \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& export PATH="/opt/miniconda-latest/bin:$PATH" \
&& echo "Downloading Miniconda installer ..." \
&& conda_installer="/tmp/miniconda.sh" \
&& curl -fsSL -o "$conda_installer" https://repo.anaconda.com/miniconda/Miniconda3-py38_22.11.1-1-Linux-x86_64.sh \
&& bash "$conda_installer" -b -p /opt/miniconda-latest \
&& rm -f "$conda_installer" \
&& conda update -yq -nbase conda \
&& conda config --system --prepend channels conda-forge \
&& conda config --system --prepend channels mrtrix3 \
# && conda config --set channel_priority false \
&& conda config --system --set auto_update_conda false \
&& conda config --system --set show_channel_urls true \
# Enable `conda activate`
&& conda init bash \
&& conda install -y --name base \
"python=3.11" \
"libstdcxx-ng" \
# Clean up
&& sync && conda clean --all --yes && sync \
&& rm -rf ~/.cache/pip/*
# **********************************************************************************************************************
# [ROOT] CREATE USER:
# The following part for the user-creation is adapted from Jupyter Docker Stacks
# https://github.com/jupyter/docker-stacks/blob/main/docker-stacks-foundation/Dockerfile
ENV HOME="/home/${NB_USER}"
RUN apt-get update --yes && apt-get upgrade --yes && apt-get install --yes --no-install-recommends \
bzip2 \
ca-certificates \
sudo && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \
sed -i.bak -e 's/^%admin/#%admin/' /etc/sudoers && \
sed -i.bak -e 's/^%sudo/#%sudo/' /etc/sudoers && \
useradd -l -m -s /bin/bash -N -u "${NB_UID}" "${NB_USER}" && \
mkdir -p "${CONDA_DIR}" && \
chown "${NB_USER}:${NB_GID}" "${CONDA_DIR}" && \
chmod g+w /etc/passwd
# fix permissions
RUN chgrp -R "${NB_GID}" "${HOME}" && chmod -R 777 "${HOME}"
RUN chgrp -R "${NB_GID}" "${CONDA_DIR}" && chmod -R g+rwX "${CONDA_DIR}" && find "${CONDA_DIR}" -type d -exec chmod +6000 {} +
# **********************************************************************************************************************
# [ROOT] INSTALL AFNI:
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
ENV PATH="/opt/afni-latest:$PATH" \
AFNI_PLUGINPATH="/opt/afni-latest"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
ca-certificates \
curl \
ed \
gsl-bin \
libgl1-mesa-dri \
libglib2.0-0 \
libglu1-mesa-dev \
libglw1-mesa \
libgomp1 \
libjpeg62 \
libxm4 \
multiarch-support \
netpbm \
tcsh \
xfonts-base \
xvfb \
&& rm -rf /var/lib/apt/lists/* \
&& _reproenv_tmppath="$(mktemp -t tmp.XXXXXXXXXX.deb)" \
&& curl -fsSL --retry 5 -o "${_reproenv_tmppath}" http://launchpadlibrarian.net/160108232/libxp6_1.0.2-1ubuntu1_amd64.deb \
&& apt-get install --yes -q "${_reproenv_tmppath}" \
&& rm "${_reproenv_tmppath}" \
&& _reproenv_tmppath="$(mktemp -t tmp.XXXXXXXXXX.deb)" \
&& curl -fsSL --retry 5 -o "${_reproenv_tmppath}" http://snapshot.debian.org/archive/debian-security/20160113T213056Z/pool/updates/main/libp/libpng/libpng12-0_1.2.49-1%2Bdeb7u2_amd64.deb \
&& apt-get install --yes -q "${_reproenv_tmppath}" \
&& rm "${_reproenv_tmppath}" \
&& apt-get update -qq \
&& apt-get install --yes --quiet --fix-missing \
&& rm -rf /var/lib/apt/lists/* \
&& gsl_path="$(find / -name 'libgsl.so.??' || printf '')" \
&& if [ -n "$gsl_path" ]; then \
ln -sfv "$gsl_path" "$(dirname $gsl_path)/libgsl.so.0"; \
fi \
&& ldconfig \
&& mkdir -p /opt/afni-latest \
&& echo "Downloading AFNI ..." \
&& curl -fL https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \
| tar -xz -C /opt/afni-latest --strip-components 1
# **********************************************************************************************************************
# [ROOT] INSTALL ANTS:
ENV ANTSPATH="/opt/ants-2.3.4/" \
PATH="/opt/ants-2.3.4:$PATH"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& echo "Downloading ANTs ..." \
&& mkdir -p /opt/ants-2.3.4 \
&& curl -fsSL https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz \
| tar -xz -C /opt/ants-2.3.4 --strip-components 1
# **********************************************************************************************************************
# [ROOT] INSTALL Convert3D:
ENV C3DPATH="/opt/convert3d-1.0.0" \
PATH="/opt/convert3d-1.0.0/bin:$PATH"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& echo "Downloading Convert3D ..." \
&& mkdir -p /opt/convert3d-1.0.0 \
&& curl -fsSL https://sourceforge.net/projects/c3d/files/c3d/1.0.0/c3d-1.0.0-Linux-x86_64.tar.gz/download \
| tar -xz -C /opt/convert3d-1.0.0 --strip-components 1
# **********************************************************************************************************************
# [ROOT] INSTALL FSL:
ENV FSLDIR="/opt/fsl-6.0.5" \
PATH="/opt/fsl-6.0.5/bin:$PATH" \
FSLOUTPUTTYPE="NIFTI_GZ" \
FSLMULTIFILEQUIT="TRUE" \
FSLTCLSH="/opt/fsl-6.0.5/bin/fsltclsh" \
FSLWISH="/opt/fsl-6.0.5/bin/fslwish" \
FSLLOCKDIR="" \
FSLMACHINELIST="" \
FSLREMOTECALL="" \
FSLGECUDAQ="cuda.q"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
bc \
ca-certificates \
curl \
dc \
file \
libfontconfig1 \
libfreetype6 \
libgl1-mesa-dev \
libgl1-mesa-dri \
libglu1-mesa-dev \
libgomp1 \
libice6 \
libopenblas-base \
libxcursor1 \
libxft2 \
libxinerama1 \
libxrandr2 \
libxrender1 \
libxt6 \
nano \
sudo \
wget \
&& rm -rf /var/lib/apt/lists/* \
&& echo "Downloading FSL ..." \
&& mkdir -p /opt/fsl-6.0.5 \
&& curl -fL https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.5-centos7_64.tar.gz \
| tar -xz -C /opt/fsl-6.0.5 --strip-components 1 \
&& echo "Installing FSL conda environment ..." \
&& bash /opt/fsl-6.0.5/etc/fslconf/fslpython_install.sh -f /opt/fsl-6.0.5
# **********************************************************************************************************************
RUN apt-get update --yes && apt-get upgrade --yes && apt-get install --yes --no-install-recommends \
graphviz \
build-essential && \
apt-get clean && rm -rf /var/lib/apt/lists/*
USER ${NB_UID}
# [USER] INSTALL REQUIRED PUMI PACKAGES:
RUN conda install -y --name base \
"mrtrix3" \
"traits" \
"numpydoc" \
"nbsphinx" \
"pybids" \
"poetry" \
"poetry-dynamic-versioning" \
"dot2tex" \
"click"
RUN pip install --no-cache-dir \
"networkx<3" \
"dot2tex>=2.11.3" \
"templateflow>=0.8.0" \
"graphviz>=0.17" \
"matplotlib>=3.5.2" \
"numpy>=1.21.1" \
"scipy>=1.7.1" \
"numpydoc>=1.1.0" \
"nbsphinx>=0.8.6" \
"pytest>=7.1.2" \
"nipype>=1.8.1" \
"neurodocker>=0.8.0" \
"nilearn>=0.9.1" \
"pybids>=0.15.1" \
"poetry>=1.1.13" \
"poetry-dynamic-versioning>=0.17.1" \
"pydeface>=2.0.0" \
"seaborn>=0.11.2" \
"myst-parser" \
"nibabel>=5.0.0" \
"git+https://github.com/MIC-DKFZ/HD-BET.git" \
"deepbet" \
"scikit-learn==1.3.2"
# **********************************************************************************************************************
# [USER] SET WORKDIR & CREATE PUMI OUTPUT DIRECTORY:
WORKDIR "${HOME}"
RUN mkdir -p "${HOME}"/PUMI/data_out
# **********************************************************************************************************************
USER root
# [ROOT] FIX PERMISSIONS:
RUN chgrp -R "${NB_GID}" "${HOME}" && chmod -R 777 "${HOME}"
# **********************************************************************************************************************
USER ${NB_UID}