-
Notifications
You must be signed in to change notification settings - Fork 31
/
Dockerfile
executable file
·379 lines (343 loc) · 13.9 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
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# Generated by: Neurodocker version 0.7.0+0.gdc97516.dirty
# Latest release: Neurodocker version 0.9.5
# Timestamp: 2023/05/18 01:58:52 UTC
#
# Thank you for using Neurodocker. If you discover any issues
# or ways to improve this software, please submit an issue or
# pull request on our GitHub repository:
#
# https://github.com/ReproNim/neurodocker
FROM ubuntu:bionic-20201119
USER root
ARG DEBIAN_FRONTEND="noninteractive"
ENV LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
ND_ENTRYPOINT="/neurodocker/startup.sh"
RUN export ND_ENTRYPOINT="/neurodocker/startup.sh" \
&& apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
apt-utils \
bzip2 \
ca-certificates \
curl \
locales \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& dpkg-reconfigure --frontend=noninteractive locales \
&& update-locale LANG="en_US.UTF-8" \
&& chmod 777 /opt && chmod a+s /opt \
&& mkdir -p /neurodocker \
&& if [ ! -f "$ND_ENTRYPOINT" ]; then \
echo '#!/usr/bin/env bash' >> "$ND_ENTRYPOINT" \
&& echo 'set -e' >> "$ND_ENTRYPOINT" \
&& echo 'export USER="${USER:=`whoami`}"' >> "$ND_ENTRYPOINT" \
&& echo 'if [ -n "$1" ]; then "$@"; else /usr/bin/env bash; fi' >> "$ND_ENTRYPOINT"; \
fi \
&& chmod -R 777 /neurodocker && chmod a+s /neurodocker
ENTRYPOINT ["/neurodocker/startup.sh"]
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
gcc g++ lsb-core bsdtar jq libopenblas-dev tree openjdk-8-jdk libstdc++6 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV PATH="/opt/dcm2niix-v1.0.20190902/bin:$PATH"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
cmake \
g++ \
gcc \
git \
make \
pigz \
zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& git clone https://github.com/rordenlab/dcm2niix /tmp/dcm2niix \
&& cd /tmp/dcm2niix \
&& git fetch --tags \
&& git checkout v1.0.20190902 \
&& mkdir /tmp/dcm2niix/build \
&& cd /tmp/dcm2niix/build \
&& cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/dcm2niix-v1.0.20190902 .. \
&& make \
&& make install \
&& rm -rf /tmp/dcm2niix
ENV FSLDIR="/opt/fsl-6.0.2" \
PATH="/opt/fsl-6.0.2/bin:$PATH" \
FSLOUTPUTTYPE="NIFTI_GZ" \
FSLMULTIFILEQUIT="TRUE" \
FSLTCLSH="/opt/fsl-6.0.2/bin/fsltclsh" \
FSLWISH="/opt/fsl-6.0.2/bin/fslwish" \
FSLLOCKDIR="" \
FSLMACHINELIST="" \
FSLREMOTECALL="" \
FSLGECUDAQ="cuda.q"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
bc \
dc \
file \
libfontconfig1 \
libfreetype6 \
libgl1-mesa-dev \
libgl1-mesa-dri \
libglu1-mesa-dev \
libgomp1 \
libice6 \
libxcursor1 \
libxft2 \
libxinerama1 \
libxrandr2 \
libxrender1 \
libxt6 \
sudo \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& echo "Downloading FSL ..." \
&& mkdir -p /opt/fsl-6.0.2 \
&& curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.2-centos6_64.tar.gz \
| tar -xz -C /opt/fsl-6.0.2 --strip-components 1 \
&& sed -i '$iecho Some packages in this Docker container are non-free' $ND_ENTRYPOINT \
&& sed -i '$iecho If you are considering commercial use of this container, please consult the relevant license:' $ND_ENTRYPOINT \
&& sed -i '$iecho https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Licence' $ND_ENTRYPOINT \
&& sed -i '$isource $FSLDIR/etc/fslconf/fsl.sh' $ND_ENTRYPOINT
RUN bash -c 'bash /opt/fsl-6.0.2/etc/fslconf/fslpython_install.sh -f /opt/fsl-6.0.2'
ENV FREESURFER_HOME="/opt/freesurfer-7.3.2" \
PATH="/opt/freesurfer-7.3.2/bin:$PATH"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
bc \
libgomp1 \
libxmu6 \
libxt6 \
perl \
tcsh \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& echo "Downloading FreeSurfer ..." \
&& mkdir -p /opt/freesurfer-7.3.2 \
&& curl -fsSL --retry 5 ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2/freesurfer-linux-ubuntu18_amd64-7.3.2.tar.gz \
| tar -xz -C /opt/freesurfer-7.3.2 --strip-components 1 \
--exclude='freesurfer/average/mult-comp-cor' \
--exclude='freesurfer/lib/cuda' \
--exclude='freesurfer/lib/qt' \
--exclude='freesurfer/subjects/V1_average' \
--exclude='freesurfer/subjects/bert' \
--exclude='freesurfer/subjects/cvs_avg35' \
--exclude='freesurfer/subjects/cvs_avg35_inMNI152' \
--exclude='freesurfer/subjects/fsaverage3' \
--exclude='freesurfer/subjects/fsaverage4' \
--exclude='freesurfer/subjects/fsaverage5' \
--exclude='freesurfer/subjects/fsaverage6' \
--exclude='freesurfer/subjects/fsaverage_sym' \
--exclude='freesurfer/trctrain' \
&& sed -i '$isource "/opt/freesurfer-7.3.2/SetUpFreeSurfer.sh"' "$ND_ENTRYPOINT"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/opt/matlabmcr-2017b/v93/runtime/glnxa64:/opt/matlabmcr-2017b/v93/bin/glnxa64:/opt/matlabmcr-2017b/v93/sys/os/glnxa64:/opt/matlabmcr-2017b/v93/extern/bin/glnxa64" \
MATLABCMD="/opt/matlabmcr-2017b/v93/toolbox/matlab"
RUN export TMPDIR="$(mktemp -d)" \
&& apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
bc \
libncurses5 \
libxext6 \
libxmu6 \
libxpm-dev \
libxt6 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& echo "Downloading MATLAB Compiler Runtime ..." \
&& curl -fsSL --retry 5 -o "$TMPDIR/mcr.zip" https://ssd.mathworks.com/supportfiles/downloads/R2017b/deployment_files/R2017b/installers/glnxa64/MCR_R2017b_glnxa64_installer.zip \
&& unzip -q "$TMPDIR/mcr.zip" -d "$TMPDIR/mcrtmp" \
&& "$TMPDIR/mcrtmp/install" -destinationFolder /opt/matlabmcr-2017b -mode silent -agreeToLicense yes \
&& rm -rf "$TMPDIR" \
&& unset TMPDIR
ENV PATH="/opt/afni-latest:$PATH" \
AFNI_PLUGINPATH="/opt/afni-latest"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
ed \
gsl-bin \
libglib2.0-0 \
libglu1-mesa-dev \
libglw1-mesa \
libgomp1 \
libjpeg62 \
libxm4 \
netpbm \
tcsh \
xfonts-base \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sSL --retry 5 -o /tmp/toinstall.deb http://launchpadlibrarian.net/160108232/libxp6_1.0.2-1ubuntu1_amd64.deb \
&& dpkg -i /tmp/toinstall.deb \
&& rm /tmp/toinstall.deb \
&& curl -sSL --retry 5 -o /tmp/toinstall.deb http://snapshot.debian.org/archive/debian-security/20160113T213056Z/pool/updates/main/libp/libpng/libpng12-0_1.2.49-1%2Bdeb7u2_amd64.deb \
&& dpkg -i /tmp/toinstall.deb \
&& rm /tmp/toinstall.deb \
&& apt-get install -f \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& gsl2_path="$(find / -name 'libgsl.so.19' || printf '')" \
&& if [ -n "$gsl2_path" ]; then \
ln -sfv "$gsl2_path" "$(dirname $gsl2_path)/libgsl.so.0"; \
fi \
&& ldconfig \
&& echo "Downloading AFNI ..." \
&& mkdir -p /opt/afni-latest \
&& curl -fsSL --retry 5 https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \
| tar -xz -C /opt/afni-latest --strip-components 1
ENV ANTSPATH="/opt/ants-2.3.4/" \
PATH="/opt/ants-2.3.4:$PATH"
RUN 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
RUN bash -c 'apt-get update && apt-get install -y gnupg2 && wget -O- http://neuro.debian.net/lists/xenial.de-fzj.full | tee /etc/apt/sources.list.d/neurodebian.sources.list && apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9 && apt-get update && apt-get install -y connectome-workbench=1.3.2-2~nd16.04+1'
RUN bash -c 'cd /opt/ && wget http://www.fmrib.ox.ac.uk/~steve/ftp/fix1.068.tar.gz && tar xvfz fix1.068.tar.gz && rm fix1.068.tar.gz'
RUN test "$(getent passwd mica)" || useradd --no-user-group --create-home --shell /bin/bash mica
USER mica
ENV CONDA_DIR="/opt/miniconda-22.11.1" \
PATH="/opt/miniconda-22.11.1/bin:$PATH"
RUN export PATH="/opt/miniconda-22.11.1/bin:$PATH" \
&& echo "Downloading Miniconda installer ..." \
&& conda_installer="/tmp/miniconda.sh" \
&& curl -fsSL --retry 5 -o "$conda_installer" https://repo.anaconda.com/miniconda/Miniconda3-py39_22.11.1-1-Linux-x86_64.sh \
&& bash "$conda_installer" -b -p /opt/miniconda-22.11.1 \
&& rm -f "$conda_installer" \
&& conda config --system --prepend channels conda-forge \
&& conda config --system --set auto_update_conda false \
&& conda config --system --set show_channel_urls true \
&& sync && conda clean -y --all && sync \
&& conda create -y -q --name micapipe \
&& conda install -y -q --name micapipe \
"python" \
"aiohttp" \
"aiosignal" \
"asn1crypto" \
"async-timeout" \
"astropy" \
"attrs" \
"bokeh" \
"cffi" \
"charset-normalizer" \
"click" \
"contourpy" \
"cryptography" \
"cycler" \
"fonttools" \
"frozenlist" \
"html5lib" \
"idna" \
"importlib-resources" \
"jinja2" \
"joblib" \
"kiwisolver" \
"lxml" \
"markupsafe" \
"matplotlib==3.4.3" \
"multidict" \
"nibabel==4.0.2" \
"nilearn" \
"numpy==1.21.5" \
"packaging" \
"pandas==1.4.4" \
"pillow" \
"pycparser" \
"pyhanko-certvalidator" \
"pyparsing" \
"pypdf" \
"pypng" \
"python-bidi" \
"python-dateutil" \
"pytz" \
"pytz-deprecation-shim" \
"pyyaml" \
"qrcode" \
"reportlab" \
"requests" \
"scikit-learn" \
"scikit-fmm" \
"scipy" \
"six" \
"svglib" \
"threadpoolctl" \
"tinycss2" \
"tornado" \
"typing-extensions" \
"tzlocal" \
"uritools" \
"urllib3" \
"vtk==9.2.2" \
"webencodings" \
"wslink" \
"yarl" \
"zipp" \
"pyvirtualdisplay==3.0" \
&& sync && conda clean -y --all && sync \
&& bash -c "source activate micapipe \
&& pip install --no-cache-dir \
"argparse==1.1" \
"brainspace==0.1.10" \
"tedana==0.0.12" \
"duecredit" \
"pyhanko==0.17.2" \
"mapca==0.0.3" \
"xhtml2pdf==0.2.9" \
"oscrypto==1.3.0" \
"tzdata==2022.7" \
"arabic-reshaper==3.0.0" \
"cssselect2==0.7.0" \
"pygeodesic==0.1.8" \
"seaborn==0.11.2"" \
&& rm -rf ~/.cache/pip/* \
&& sync \
&& sed -i '$isource activate micapipe' $ND_ENTRYPOINT
RUN bash -c 'source activate micapipe && conda install -c mrtrix3 mrtrix3==3.0.1 && pip install git+https://github.com/MICA-MNI/ENIGMA.git'
ENV PATH="/opt/FastSurfer:$PATH"
ENV FASTSURFER_HOME=/opt/FastSurfer
RUN git clone https://github.com/Deep-MI/FastSurfer.git /opt/FastSurfer && cd /opt/FastSurfer && git checkout stable && ls /opt/FastSurfer
RUN cd /opt/FastSurfer \
&& bash -c 'wget --no-check-certificate -qO /tmp/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py38_4.11.0-Linux-x86_64.sh \
&& chmod +x /tmp/miniconda.sh \
&& /tmp/miniconda.sh -b -p /opt/conda \
&& rm /tmp/miniconda.sh \
&& conda env create -f ./fastsurfer_env_cpu.yml'
# Install FastSurferCNN module
ENV PYTHONPATH="${PYTHONPATH}:/opt/FastSurfer"
RUN bash -c "source activate fastsurfer_cpu && cd /opt/FastSurfer && python FastSurferCNN/download_checkpoints.py --all && source deactivate"
USER root
RUN apt-get update -qq && apt-get install -y -q --no-install-recommends xvfb && apt-get clean
# R and libraries
RUN set -uex; \
LD_LIBRARY_PATH=/lib64/:${PATH}; \
apt update; \
apt install -y software-properties-common apt-transport-https; \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9; \
add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'; \
apt-get update; \
apt-get install -y r-base libblas-dev liblapack-dev gfortran g++ libgl1-mesa-glx; \
apt-get install -y r-base-dev; \
rm -rf /var/lib/apt/lists/*;
COPY ./R_config/* /opt/
RUN bash -c 'bash /opt/install_R_env.sh && cd /opt/afni-latest && rPkgsInstall -pkgs ALL'
# Install c3d
RUN set -uex; \
cd /opt/ && \
wget -O itksnap.tar.gz https://sourceforge.net/projects/c3d/files/c3d/1.0.0/c3d-1.0.0-Linux-x86_64.tar.gz/download && \
tar -xf itksnap.tar.gz -C /opt/ && \
rm itksnap.tar.gz
ENV PATH="/opt/c3d-1.0.0-Linux-x86_64/bin:${PATH}"
COPY . /opt/micapipe/
RUN bash -c 'cd /opt/micapipe && mv fix_settings.sh /opt/fix1.068/settings.sh && mv fsl_conf/* /opt/fsl-6.0.2/etc/flirtsch/'
RUN bash -c 'cp -r /opt/micapipe/surfaces/fsaverage5 /opt/freesurfer-7.3.2/subjects'
WORKDIR /home/mica
ENV MICAPIPE="/opt/micapipe"
ENV PROC="container_micapipe-v0.2.3"
ENV FIXPATH=/opt/fix1.068
ENV PATH="/opt/fix1.068/:${PATH}"
ENV PATH="/opt/micapipe/:/opt/micapipe/functions:${PATH}"
ENTRYPOINT ["/neurodocker/startup.sh", "/opt/micapipe/micapipe"]