22
22
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
23
# SOFTWARE.
24
24
25
- # Use Ubuntu 16 .04 LTS
26
- FROM ubuntu:xenial-20201030
25
+ # Use Ubuntu 20 .04 LTS
26
+ FROM ubuntu:focal-20210416
27
27
28
28
# Prepare environment
29
29
RUN apt-get update && \
30
30
apt-get install -y --no-install-recommends \
31
+ apt-utils \
31
32
autoconf \
32
33
build-essential \
33
34
bzip2 \
34
35
ca-certificates \
35
36
curl \
36
- cython3 \
37
37
git \
38
38
libtool \
39
39
lsb-release \
40
40
pkg-config \
41
+ unzip \
41
42
xvfb && \
42
43
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
43
44
45
+ ENV DEBIAN_FRONTEND="noninteractive" \
46
+ LANG="en_US.UTF-8" \
47
+ LC_ALL="en_US.UTF-8"
48
+
44
49
# Installing freesurfer
45
- 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 \
50
+ 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 \
51
+ | tar zxv --no-same-owner -C /opt \
46
52
--exclude='freesurfer/diffusion' \
47
53
--exclude='freesurfer/docs' \
48
54
--exclude='freesurfer/fsfast' \
@@ -62,7 +68,8 @@ RUN curl -sSL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.1/frees
62
68
--exclude='freesurfer/subjects/V1_average' \
63
69
--exclude='freesurfer/trctrain'
64
70
65
- ENV FSL_DIR="/usr/share/fsl/5.0" \
71
+ # Simulate SetUpFreeSurfer.sh
72
+ ENV FSL_DIR="/opt/fsl-6.0.5.1" \
66
73
OS="Linux" \
67
74
FS_OVERRIDE=0 \
68
75
FIX_VERTEX_AREA="" \
@@ -79,82 +86,176 @@ ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
79
86
MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
80
87
PATH="$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH"
81
88
82
- # Pre-cache neurodebian key
83
- COPY docker/files/neurodebian.gpg /usr/local/etc/neurodebian.gpg
84
- # Installing Neurodebian packages (FSL, AFNI, git)
85
- RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \
86
- apt-key add /usr/local/etc/neurodebian.gpg && \
87
- (apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)
88
-
89
- RUN apt-get update && \
90
- apt-get install -y --no-install-recommends \
91
- fsl-core=5.0.9-5~nd16.04+1 \
92
- afni=16.2.07~dfsg.1-5~nd16.04+1 \
93
- convert3d && \
94
- apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
95
-
96
- ENV FSLDIR="/usr/share/fsl/5.0" \
89
+ # FSL 6.0.5.1
90
+ RUN apt-get update -qq \
91
+ && apt-get install -y -q --no-install-recommends \
92
+ bc \
93
+ dc \
94
+ file \
95
+ libfontconfig1 \
96
+ libfreetype6 \
97
+ libgl1-mesa-dev \
98
+ libgl1-mesa-dri \
99
+ libglu1-mesa-dev \
100
+ libgomp1 \
101
+ libice6 \
102
+ libxcursor1 \
103
+ libxft2 \
104
+ libxinerama1 \
105
+ libxrandr2 \
106
+ libxrender1 \
107
+ libxt6 \
108
+ sudo \
109
+ wget \
110
+ && apt-get clean \
111
+ && rm -rf /var/lib/apt/lists/* \
112
+ && echo "Downloading FSL ..." \
113
+ && mkdir -p /opt/fsl-6.0.5.1 \
114
+ && curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.5.1-centos7_64.tar.gz \
115
+ | tar -xz -C /opt/fsl-6.0.5.1 --strip-components 1 \
116
+ --exclude "fsl/config" \
117
+ --exclude "fsl/data/atlases" \
118
+ --exclude "fsl/data/first" \
119
+ --exclude "fsl/data/mist" \
120
+ --exclude "fsl/data/possum" \
121
+ --exclude "fsl/data/standard/bianca" \
122
+ --exclude "fsl/data/standard/tissuepriors" \
123
+ --exclude "fsl/doc" \
124
+ --exclude "fsl/etc/default_flobs.flobs" \
125
+ --exclude "fsl/etc/fslconf" \
126
+ --exclude "fsl/etc/js" \
127
+ --exclude "fsl/etc/luts" \
128
+ --exclude "fsl/etc/matlab" \
129
+ --exclude "fsl/extras" \
130
+ --exclude "fsl/include" \
131
+ --exclude "fsl/python" \
132
+ --exclude "fsl/refdoc" \
133
+ --exclude "fsl/src" \
134
+ --exclude "fsl/tcl" \
135
+ --exclude "fsl/bin/FSLeyes" \
136
+ && find /opt/fsl-6.0.5.1/bin -type f -not \( \
137
+ -name "applywarp" -or \
138
+ -name "bet" -or \
139
+ -name "bet2" -or \
140
+ -name "convert_xfm" -or \
141
+ -name "fast" -or \
142
+ -name "flirt" -or \
143
+ -name "fsl_regfilt" -or \
144
+ -name "fslhd" -or \
145
+ -name "fslinfo" -or \
146
+ -name "fslmaths" -or \
147
+ -name "fslmerge" -or \
148
+ -name "fslroi" -or \
149
+ -name "fslsplit" -or \
150
+ -name "fslstats" -or \
151
+ -name "imtest" -or \
152
+ -name "mcflirt" -or \
153
+ -name "melodic" -or \
154
+ -name "prelude" -or \
155
+ -name "remove_ext" -or \
156
+ -name "susan" -or \
157
+ -name "topup" -or \
158
+ -name "zeropad" \) -delete \
159
+ && find /opt/fsl-6.0.5.1/data/standard -type f -not -name "MNI152_T1_2mm_brain.nii.gz" -delete
160
+ ENV FSLDIR="/opt/fsl-6.0.5.1" \
161
+ PATH="/opt/fsl-6.0.5.1/bin:$PATH" \
97
162
FSLOUTPUTTYPE="NIFTI_GZ" \
98
163
FSLMULTIFILEQUIT="TRUE" \
99
- POSSUMDIR="/usr/share/fsl/5.0" \
100
- LD_LIBRARY_PATH="/usr/lib/fsl/5.0:$LD_LIBRARY_PATH" \
101
- FSLTCLSH="/usr/bin/tclsh" \
102
- FSLWISH="/usr/bin/wish" \
103
- AFNI_MODELPATH="/usr/lib/afni/models" \
164
+ FSLLOCKDIR="" \
165
+ FSLMACHINELIST="" \
166
+ FSLREMOTECALL="" \
167
+ FSLGECUDAQ="cuda.q" \
168
+ LD_LIBRARY_PATH="/opt/fsl-6.0.5.1/lib:$LD_LIBRARY_PATH"
169
+
170
+ # Convert3D (neurodocker build)
171
+ RUN echo "Downloading Convert3D ..." \
172
+ && mkdir -p /opt/convert3d-1.0.0 \
173
+ && curl -fsSL --retry 5 https://sourceforge.net/projects/c3d/files/c3d/1.0.0/c3d-1.0.0-Linux-x86_64.tar.gz/download \
174
+ | tar -xz -C /opt/convert3d-1.0.0 --strip-components 1 \
175
+ --exclude "c3d-1.0.0-Linux-x86_64/lib" \
176
+ --exclude "c3d-1.0.0-Linux-x86_64/share" \
177
+ --exclude "c3d-1.0.0-Linux-x86_64/bin/c3d_gui"
178
+ ENV C3DPATH="/opt/convert3d-1.0.0" \
179
+ PATH="/opt/convert3d-1.0.0/bin:$PATH"
180
+
181
+ # AFNI latest (neurodocker build)
182
+ RUN apt-get update -qq \
183
+ && apt-get install -y -q --no-install-recommends \
184
+ apt-utils \
185
+ ed \
186
+ gsl-bin \
187
+ libglib2.0-0 \
188
+ libglu1-mesa-dev \
189
+ libglw1-mesa \
190
+ libgomp1 \
191
+ libjpeg62 \
192
+ libxm4 \
193
+ netpbm \
194
+ tcsh \
195
+ xfonts-base \
196
+ xvfb \
197
+ && apt-get clean \
198
+ && rm -rf /var/lib/apt/lists/* \
199
+ && curl -sSL --retry 5 -o /tmp/multiarch.deb http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/multiarch-support_2.27-3ubuntu1.2_amd64.deb \
200
+ && dpkg -i /tmp/multiarch.deb \
201
+ && rm /tmp/multiarch.deb \
202
+ && curl -sSL --retry 5 -o /tmp/libxp6.deb http://mirrors.kernel.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb \
203
+ && dpkg -i /tmp/libxp6.deb \
204
+ && rm /tmp/libxp6.deb \
205
+ && curl -sSL --retry 5 -o /tmp/libpng.deb http://snapshot.debian.org/archive/debian-security/20160113T213056Z/pool/updates/main/libp/libpng/libpng12-0_1.2.49-1%2Bdeb7u2_amd64.deb \
206
+ && dpkg -i /tmp/libpng.deb \
207
+ && rm /tmp/libpng.deb \
208
+ && apt-get install -f \
209
+ && apt-get clean \
210
+ && rm -rf /var/lib/apt/lists/* \
211
+ && gsl2_path="$(find / -name 'libgsl.so.19' || printf '')" \
212
+ && if [ -n "$gsl2_path" ]; then \
213
+ ln -sfv "$gsl2_path" "$(dirname $gsl2_path)/libgsl.so.0" ; \
214
+ fi \
215
+ && ldconfig \
216
+ && echo "Downloading AFNI ..." \
217
+ && mkdir -p /opt/afni-latest \
218
+ && curl -fsSL --retry 5 https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \
219
+ | tar -xz -C /opt/afni-latest --strip-components 1 \
220
+ --exclude "linux_openmp_64/*.gz" \
221
+ --exclude "linux_openmp_64/funstuff" \
222
+ --exclude "linux_openmp_64/shiny" \
223
+ --exclude "linux_openmp_64/afnipy" \
224
+ --exclude "linux_openmp_64/lib/RetroTS" \
225
+ --exclude "linux_openmp_64/meica.libs" \
226
+ # Keep only what we use
227
+ && find /opt/afni-latest -type f -not \( \
228
+ -name "3dTshift" -or \
229
+ -name "3dUnifize" -or \
230
+ -name "3dAutomask" -or \
231
+ -name "3dvolreg" \) -delete
232
+
233
+ ENV PATH="/opt/afni-latest:$PATH" \
104
234
AFNI_IMSAVE_WARNINGS="NO" \
105
- AFNI_TTATLAS_DATASET="/usr/share/afni/atlases" \
106
- AFNI_PLUGINPATH="/usr/lib/afni/plugins"
107
- ENV PATH="/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH"
235
+ AFNI_PLUGINPATH="/opt/afni-latest"
108
236
109
237
# Installing ANTs 2.3.3 (NeuroDocker build)
110
238
# Note: the URL says 2.3.4 but it is actually 2.3.3
111
- ENV ANTSPATH=/usr/lib/ants
112
- RUN mkdir -p $ANTSPATH && \
113
- curl -sSL "https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz" \
239
+ ENV ANTSPATH="/opt/ants" \
240
+ PATH="/opt/ants:$PATH"
241
+ WORKDIR $ANTSPATH
242
+ RUN curl -sSL "https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz" \
114
243
| tar -xzC $ANTSPATH --strip-components 1
115
- ENV PATH=$ANTSPATH:$PATH
116
244
117
- # Installing and setting up miniconda
118
- RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \
119
- bash Miniconda3-4.5.11-Linux-x86_64.sh -b -p /usr/local/miniconda && \
120
- rm Miniconda3-4.5.11-Linux-x86_64.sh
245
+ COPY --from=nipreps/miniconda@sha256:4d0dc0fabb794e9fe22ee468ae5f86c2c8c2b4cd9d7b7fdf0c134d9e13838729 /opt/conda /opt/conda
246
+
247
+ RUN ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
248
+ echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
249
+ echo "conda activate base" >> ~/.bashrc
121
250
122
251
# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip)
123
- ENV PATH="/usr/local/miniconda/bin:$PATH" \
124
- CPATH="/usr/local/miniconda/include/:$CPATH" \
252
+ ENV PATH="/opt/conda/bin:$PATH" \
253
+ CPATH="/opt/conda/include:$CPATH" \
254
+ LD_LIBRARY_PATH="/opt/conda/lib:$LD_LIBRARY_PATH" \
125
255
LANG="C.UTF-8" \
126
256
LC_ALL="C.UTF-8" \
127
257
PYTHONNOUSERSITE=1
128
258
129
- # Installing precomputed python packages
130
- RUN conda install -y -c anaconda -c conda-forge \
131
- python=3.7.1 \
132
- graphviz=2.40 \
133
- git-annex \
134
- libxml2=2.9.8 \
135
- libxslt=1.1.32 \
136
- matplotlib=2.2 \
137
- mkl-service \
138
- mkl \
139
- nodejs \
140
- numpy=1.20 \
141
- pandas=0.23 \
142
- pandoc=2.11 \
143
- pip=20.3 \
144
- scikit-learn=0.19 \
145
- scipy=1.5 \
146
- setuptools=51.1 \
147
- traits=4.6.0 \
148
- zlib; sync && \
149
- chmod -R a+rX /usr/local/miniconda; sync && \
150
- chmod +x /usr/local/miniconda/bin/*; sync && \
151
- conda clean --all -y; sync && \
152
- conda clean -tipsy && sync
153
-
154
- # Precaching fonts, set 'Agg' as default backend for matplotlib
155
- RUN python -c "from matplotlib import font_manager" && \
156
- sed -i 's/\( backend *: \) .*$/\1 Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )
157
-
158
259
# Unless otherwise specified each process should only use one thread - nipype
159
260
# will handle parallelization
160
261
ENV MKL_NUM_THREADS=1 \
@@ -163,39 +264,41 @@ ENV MKL_NUM_THREADS=1 \
163
264
# Create a shared $HOME directory
164
265
RUN useradd -m -s /bin/bash -G users smriprep
165
266
WORKDIR /home/smriprep
166
- ENV HOME="/home/smriprep"
267
+ ENV HOME="/home/smriprep" \
268
+ LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"
167
269
168
- # Installing SVGO
169
- RUN npm install -g svgo
270
+ RUN echo ". /opt/conda/etc/profile.d/conda.sh" >> $HOME/.bashrc && \
271
+ echo "conda activate base" >> $HOME/.bashrc
170
272
171
- # Installing bids-validator
172
- RUN npm install -g [email protected]
273
+ # Precaching atlases
274
+ COPY scripts/fetch_templates.py fetch_templates.py
173
275
174
- # Refresh linked libraries
175
- RUN ldconfig
176
-
177
- # Installing dev requirements (packages that are not in pypi)
178
- WORKDIR /src/
276
+ RUN /opt/conda/bin/python fetch_templates.py && \
277
+ rm fetch_templates.py && \
278
+ find $HOME/.cache/templateflow -type d -exec chmod go=u {} + && \
279
+ find $HOME/.cache/templateflow -type f -exec chmod go=u {} +
179
280
180
281
# Installing sMRIPREP
181
282
COPY . /src/smriprep
182
283
ARG VERSION
183
284
# Force static versioning within container
184
285
RUN echo "${VERSION}" > /src/smriprep/smriprep/VERSION && \
185
- cd /src/smriprep && \
186
- pip install --no-cache-dir .[all] && \
187
- rm -rf $HOME/.cache/pip
286
+ echo "include smriprep/VERSION" >> /src/smriprep/MANIFEST.in && \
287
+ /opt/conda/bin/python -m pip install --no-cache-dir "/src/smriprep[all]"
188
288
189
289
RUN find $HOME -type d -exec chmod go=u {} + && \
190
- find $HOME -type f -exec chmod go=u {} +
290
+ find $HOME -type f -exec chmod go=u {} + && \
291
+ rm -rf $HOME/.npm $HOME/.conda $HOME/.empty
191
292
192
293
ENV IS_DOCKER_8395080871=1
193
294
194
- WORKDIR /tmp/
195
- ENTRYPOINT ["/usr/local/miniconda/bin/smriprep" ]
295
+ RUN ldconfig
296
+ WORKDIR /tmp
297
+ ENTRYPOINT ["/opt/conda/bin/smriprep" ]
196
298
197
299
ARG BUILD_DATE
198
300
ARG VCS_REF
301
+ ARG VERSION
199
302
LABEL org.label-schema.build-date=$BUILD_DATE \
200
303
org.label-schema.name="sMRIPrep" \
201
304
org.label-schema.description="sMRIPrep - robust structural MRI preprocessing tool" \
0 commit comments