This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathDockerfilex
executable file
·283 lines (240 loc) · 10.4 KB
/
Dockerfilex
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
FROM neurodebian:stretch
FROM rocker/rstudio:3.6.3
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 \
python3-dev \
gcc \
curl \
locales \
unzip \
wget \
zlib1g-dev \
libnifti-dev \
libxml2-dev \
libssl-dev \
libcurl4-openssl-dev \
libssl-dev \
libcairo2-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& 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"; \
fi \
&& chmod -R 777 /neurodocker && chmod a+s /neurodocker
RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \
bash Miniconda3-4.5.11-Linux-x86_64.sh -b -p /usr/local/miniconda && \
rm Miniconda3-4.5.11-Linux-x86_64.sh
ENV PATH="/usr/local/miniconda/bin:$PATH" \
CPATH="/usr/local/miniconda/include/:$CPATH" \
LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
PYTHONNOUSERSITE=1
RUN conda install -y python=3.7.1 \
pip=19.1 \
mkl=2018.0.3 \
mkl-service \
scipy \
libxml2=2.9.8 \
libxslt=1.1.32 \
zlib; sync && \
chmod -R a+rX /usr/local/miniconda; sync && \
chmod +x /usr/local/miniconda/bin/*; sync && \
conda build purge-all; sync && \
conda clean -tipsy && sync
ENV FSLDIR="/opt/fsl-5.0.10" \
PATH="/opt/fsl-5.0.10/bin:$PATH"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
bc \
git \
wget \
dc \
file \
libfontconfig1 \
libfreetype6 \
libgl1-mesa-dev \
libglu1-mesa-dev \
libgomp1 \
libice6 \
libmng1 \
libxcursor1 \
libxft2 \
libxinerama1 \
libxrandr2 \
libxrender1 \
libxt6 \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& echo "Downloading FSL ..." \
&& mkdir -p /opt/fsl-5.0.10 \
&& curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-5.0.10-centos6_64.tar.gz \
| tar -xz -C /opt/fsl-5.0.10 --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 \
&& echo "Installing FSL conda environment ..." \
&& bash /opt/fsl-5.0.10/etc/fslconf/fslpython_install.sh -f /opt/fsl-5.0.10
ENV C3DPATH="/opt/convert3d-1.0.0" \
PATH="/opt/convert3d-1.0.0/bin:$PATH"
RUN echo "Downloading Convert3D ..." \
&& mkdir -p /opt/convert3d-1.0.0 \
&& curl -fsSL --retry 5 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
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 \
libnlopt-dev \
libxm4 \
netpbm \
r-base \
r-base-dev \
tcsh \
xfonts-base \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& curl -sSL --retry 5 -o /tmp/libxp6_1.0.2-2_amd64.deb http://mirrors.kernel.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb \
&& dpkg -i /tmp/libxp6_1.0.2-2_amd64.deb \
&& rm /tmp/libxp6_1.0.2-2_amd64.deb \
&& apt-get clean && apt-get update && apt-get -f install && dpkg --configure -a && apt-get update \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& curl -o /tmp/libpng12-0_1.2.50-2+deb8u3_amd64.deb -sSL http://mirrors.kernel.org/debian/pool/main/libp/libpng/libpng12-0_1.2.50-2+deb8u3_amd64.deb \
&& dpkg -i /tmp/libpng12-0_1.2.50-2+deb8u3_amd64.deb \
&& rm /tmp/libpng12-0_1.2.50-2+deb8u3_amd64.deb \
&& apt-get install -f \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& 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 \
&& PATH=$PATH:/opt/afni-latest rPkgsInstall -pkgs ALL
RUN bash -c 'export PATH=/opt/afni-latest:$PATH && rPkgsInstall -pkgs ALL && rPkgsInstall -pkgs optparse,pracma,RNifti,svglite,signal,reshape2,ggplot2,lme4'
# Installing ANTs latest from source
ARG ANTS_SHA=51855944553a73960662d3e4f7c1326e584b23b2
ADD https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh /cmake-3.11.4-Linux-x86_64.sh
ENV ANTSPATH="/opt/ants-latest/bin" \
PATH="/opt/ants-latest/bin:$PATH" \
LD_LIBRARY_PATH="/opt/ants-latest/lib:$LD_LIBRARY_PATH"
RUN mkdir /opt/cmake \
&& sh /cmake-3.11.4-Linux-x86_64.sh --prefix=/opt/cmake --skip-license \
&& ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake \
&& apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
g++ \
gcc \
make \
zlib1g-dev \
imagemagick \
&& mkdir /tmp/ants \
&& cd /tmp \
&& curl -sSLO https://github.com/ANTsX/ANTs/archive/${ANTS_SHA}.zip \
&& unzip ${ANTS_SHA}.zip \
&& mv ANTs-${ANTS_SHA} /tmp/ants/source \
&& rm ${ANTS_SHA}.zip \
&& mkdir -p /tmp/ants/build \
&& cd /tmp/ants/build \
&& git config --global url."https://".insteadOf git:// \
&& cmake -DBUILD_SHARED_LIBS=ON /tmp/ants/source \
&& make -j1 \
&& mkdir -p /opt/ants-latest \
&& mv bin lib /opt/ants-latest/ \
&& mv /tmp/ants/source/Scripts/* /opt/ants-latest/bin \
&& rm -rf /tmp/ants \
&& rm -rf /opt/cmake /usr/local/bin/cmake
ENV C3DPATH="/opt/convert3d-nightly" \
PATH="/opt/convert3d-nightly/bin:$PATH"
RUN echo "Downloading Convert3D ..." \
&& mkdir -p /opt/convert3d-nightly \
&& curl -fsSL --retry 5 https://sourceforge.net/projects/c3d/files/c3d/Nightly/c3d-nightly-Linux-x86_64.tar.gz/download \
| tar -xz -C /opt/convert3d-nightly --strip-components 1
RUN curl -sSL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.1/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.1.tar.gz | tar zxv --no-same-owner -C /opt \
--exclude='freesurfer/diffusion' \
--exclude='freesurfer/docs' \
--exclude='freesurfer/fsfast' \
--exclude='freesurfer/lib/cuda' \
--exclude='freesurfer/lib/qt' \
--exclude='freesurfer/matlab' \
--exclude='freesurfer/mni/share/man' \
--exclude='freesurfer/subjects/fsaverage_sym' \
--exclude='freesurfer/subjects/fsaverage3' \
--exclude='freesurfer/subjects/fsaverage4' \
--exclude='freesurfer/subjects/cvs_avg35' \
--exclude='freesurfer/subjects/cvs_avg35_inMNI152' \
--exclude='freesurfer/subjects/bert' \
--exclude='freesurfer/subjects/lh.EC_average' \
--exclude='freesurfer/subjects/rh.EC_average' \
--exclude='freesurfer/subjects/sample-*.mgz' \
--exclude='freesurfer/subjects/V1_average' \
--exclude='freesurfer/trctrain'
RUN apt-get install -y -q --no-install-recommends procps
ENV USER=root
RUN sed -i '$iexport XCPEDIR=/xcpEngine' $ND_ENTRYPOINT
RUN sed -i '$iexport PATH=$PATH:$XCPEDIR' $ND_ENTRYPOINT
RUN echo 'export USER="${USER:=`whoami`}"' >> "$ND_ENTRYPOINT"
RUN pip install --no-cache-dir nipype nibabel niworkflows==1.1.10 nilearn matplotlib
RUN pip install --no-cache-dir numpy pandas traits scikit-learn svgutils==0.3.1
RUN rm -rf ~/.cache/pip/* && sync
RUN apt-get update
ADD . /xcpEngine
# template
RUN bash -c \
'cd /xcpEngine \
&& wget -nv https://upenn.box.com/shared/static/x95ygarwv14sv608muz06tfrmlmo222z.xz \
&& tar -xf x95ygarwv14sv608muz06tfrmlmo222z.xz \
&& rm x95ygarwv14sv608muz06tfrmlmo222z.xz'
RUN bash -c 'BRAINATLAS=/xcpEngine/atlas BRAINSPACE=/xcpEngine/space XCPEDIR=/xcpEngine FSLDIR=/opt/fsl-5.0.10 AFNI_PATH=/opt/afni-latest C3D_PATH=/opt/convert3d-nightly/bin ANTSPATH=/opt/ants-latest/bin /xcpEngine/xcpReset \
&& BRAINATLAS=/xcpEngine/atlas BRAINSPACE=/xcpEngine/space XCPEDIR=/xcpEngine /xcpEngine/utils/repairMetadata'
RUN bash -c 'echo R_ENVIRON_USER\="" >> /usr/lib/R/etc/Renviron \
&& echo R_PROFILE_USER\="" >> /usr/lib/R/etc/Renviron \
&& chmod a+rx /xcpEngine/xcpEngine'
ENV workbench="/xcpEngine/thirdparty/workbench/bin_rh_linux64" \
PATH="/xcpEngine/thirdparty/workbench/bin_rh_linux64:$PATH"
ENV FREESURFER_HOME="/opt/freesurfer" \
PATH="/opt/freesurfer:$PATH"
RUN R -e "install.packages(c('optparse', 'pracma', 'RNifti', \
'svglite','signal','reshape2','ggplot2','lme4'), \
repos='http://cran.rstudio.com/')"
ENV XCPEDIR="/xcpEngine" \
AFNI_PATH="/opt/afni-latest/" \
FREESURFER_HOME="/opt/freesurfer" \
workbench="/xcpEngine/thirdparty/workbench/bin_rh_linux64" \
C3D_PATH="/opt/convert3d-nightly/bin/" \
PATH="$PATH:/xcpEngine"
RUN mkdir /data /out /work /design /cohort
RUN mkdir /run/uuidd
RUN apt-get install -y -q --no-install-recommends uuid-runtime
RUN apt-get install libgsl0-dev
RUN ln /usr/lib/libgsl.so /usr/lib/libgsl.so.0
RUN pip install --no-cache-dir flywheel-sdk numpy pandas scipy sentry_sdk psutil
RUN bash -c 'cp /xcpEngine/utils/license.txt /opt/freesurfer/'
RUN bash -c '/xcpEngine/xcpReset'
ENTRYPOINT ["/xcpEngine/xcpEngine"]