-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
335 lines (273 loc) · 11.2 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
FROM ubuntu:focal-20210416
MAINTAINER Chidi Ugonna<chidiugonna@arizona.edu>
ENV DEBIAN_FRONTEND noninteractive
##########################
# CREATE BIND and CUSTOM FOLDERS
###########################
RUN mkdir -p /xdisk /groups /opt/data /opt/bin /opt/tmp /opt/work /opt/input /opt/output /opt/config /opt/ohpc /cm/shared /cm/local
##########################
# BASE PACKAGES and LOCALE
###########################
RUN apt update && \
apt install -y nano \
apt-utils \
wget \
curl \
dc \
lsb-core \
unzip \
git \
locales
ENV TZ=America/Phoenix
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV LC_CTYPE="en_US.UTF-8"
ENV LC_ALL="en_US.UTF-8"
ENV LANG="en_US.UTF-8"
ENV LANGUAGE=en_US.UTF-8
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
RUN echo "LANG=en_US.UTF-8" > /etc/locale.conf
RUN locale-gen en_US.UTF-8
RUN export LC_ALL=en_US.UTF-8
############################
# CUDA 9.1
############################
WORKDIR /opt/tmp
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/lib:$LD_LIBRARY_PATH
RUN wget https://developer.nvidia.com/compute/cuda/9.1/Prod/local_installers/cuda_9.1.85_387.26_linux && \
mkdir -p nvidia_installers && \
chmod +x cuda_9.1.85_387.26_linux && \
./cuda_9.1.85_387.26_linux -extract=`pwd`/nvidia_installers && \
rm cuda_9.1.85_387.26_linux && \
cd nvidia_installers && \
./cuda*.run --tar mxvf && \
cp InstallUtils.pm /usr/lib/x86_64-linux-gnu/perl-base && \
rm cuda-samples* && \
rm NVIDIA-Linux* && \
./cuda-linux.9.1.85-23083092.run -noprompt && \
wget https://developer.nvidia.com/compute/cuda/9.1/Prod/patches/1/cuda_9.1.85.1_linux && \
chmod +x cuda_9.1.85.1_linux && \
./cuda_9.1.85.1_linux --silent -accept-eula && \
wget https://developer.nvidia.com/compute/cuda/9.1/Prod/patches/2/cuda_9.1.85.2_linux && \
chmod +x cuda_9.1.85.2_linux && \
./cuda_9.1.85.2_linux --silent -accept-eula && \
wget https://developer.nvidia.com/compute/cuda/9.1/Prod/patches/3/cuda_9.1.85.3_linux && \
chmod +x cuda_9.1.85.3_linux && \
./cuda_9.1.85.3_linux --silent -accept-eula && \
cd .. && \
rm -R nvidia_installers
############################
# MINICONDA and Python
############################
WORKDIR /opt/tmp
ENV MINICONDA_HOME=/opt/miniconda
ENV PATH=${MINICONDA_HOME}/bin:${PATH}
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.9.0-0-Linux-x86_64.sh && \
chmod +x Miniconda3-py310_23.9.0-0-Linux-x86_64.sh && \
/bin/bash ./Miniconda3-py310_23.9.0-0-Linux-x86_64.sh -b -p ${MINICONDA_HOME} -f && \
conda install -y pip
#################################################################################
# FSL 6.0.7.4
#
# To install FSL versions < 6.0.6 then use fslinstaller_old.py or grab from cloud
# wget https://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py
#################################################################################
WORKDIR /opt/tmp
RUN apt install -y freeglut3 \
libfontconfig1 \
libxrender1
ENV FSLVER="6.0.7.4"
ENV FSLDIR=/opt/fsl
COPY ./src/fslinstaller.py /opt/tmp
RUN python fslinstaller.py -q -d $FSLDIR -V 6.0.7.4
#change from sh to bash in randomize_parallel
RUN cp /opt/fsl/bin/randomise_parallel /opt/fsl/bin/old_randomise_parallel && \
sed -i "s^bin/sh^bin/bash^g" /opt/fsl/bin/randomise_parallel
ENV LD_LIBRARY_PATH=$FSLDIR/lib:$LD_LIBRARY_PATH
ENV FSLOUTPUTTYPE=NIFTI_GZ
##########################################################################################
#install probtrackx2 for CUDA 9.1 - note that the commented link below for FSL 5.* versions
# #wget http://users.fmrib.ox.ac.uk/~moisesf/Probtrackx_GPU/CUDA_9.1/probtrackx2_gpu.zip
#the link that is used below is for FSL 6.* versions.
#################################################################
RUN mkdir -p /opt/tmp/probtrackx && \
cd /opt/tmp/probtrackx && \
wget http://users.fmrib.ox.ac.uk/~moisesf/Probtrackx_GPU/FSL_6/CUDA_9.1/probtrackx2_gpu.zip && \
unzip probtrackx2_gpu.zip && \
rm -f probtrackx2_gpu.zip && \
mv probtrackx2_gpu $FSLDIR/bin
###########################################################################################
#install bedpostx for CUDA 9.1 - note that the commented link is for FSL 5.* versions
# #wget http://users.fmrib.ox.ac.uk/~moisesf/Bedpostx_GPU/CUDA_9.1/bedpostx_gpu.zip
#the link that is used below is for FSL 6.* versions.
#########################################################################################
RUN mkdir -p /opt/tmp/bedpost && \
cd /opt/tmp/bedpost && \
wget http://users.fmrib.ox.ac.uk/~moisesf/Bedpostx_GPU/FSL_6/CUDA_9.1/bedpostx_gpu.zip && \
unzip bedpostx_gpu.zip && \
rm -f bedpostx_gpu.zip && \
cp /opt/tmp/bedpost/bin/* $FSLDIR/bin && \
cp /opt/tmp/bedpost/lib/* $FSLDIR/lib && \
sed -i 's\#!/bin/sh\#!/bin/bash\g' $FSLDIR/bin/bedpostx_postproc_gpu.sh
##################################################
# Issues faced with git clone
#
##################################################
RUN apt install ca-certificates && \
update-ca-certificates
#########################
# MRTRIX 3.0.4
#########################
WORKDIR /opt
ENV PATH=/opt/mrtrix3/bin:$PATH
RUN apt install -y dc \
libqt5opengl5-dev \
libqt5svg5-dev \
libtiff5-dev \
git \
g++ \
libeigen3-dev \
zlib1g-dev \
libgl1-mesa-dev \
libfftw3-dev \
libpng-dev
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}
RUN git clone https://github.com/MRtrix3/mrtrix3.git && \
cd /opt/mrtrix3 && \
git checkout 3.0.4 && \
./configure && \
./build
############################
# FREESURFER 7.3.2
###########################
WORKDIR /opt
ENV LD_LIBRARY_PATH=/opt/freesurfer/lib/qt/lib:/opt/freesurfer/mni/lib:${LD_LIBRARY_PATH}
ENV FSL_DIR=${FSLDIR}
RUN apt update && \
apt install -y tcsh \
libxmu6 \
libglu1-mesa
ENV FREESURFER_HOME=/opt/freesurfer
ENV FS_LICENSE=${FREESURFER_HOME}/license.txt
ENV PATH=$FREESURFER_HOME/bin:$FREESURFER_HOME/mni/bin:$FREESURFER_HOME/tktools:$PATH
RUN wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2/freesurfer-linux-ubuntu20_amd64-7.3.2.tar.gz && \
tar xz -f freesurfer-linux-ubuntu20_amd64-7.3.2.tar.gz && \
rm /opt/freesurfer-linux-ubuntu20_amd64-7.3.2.tar.gz
# create symbolic link as tkregister not provided in Freesurfer 7.1.1
RUN ln -s /opt/freesurfer/tktools/tkregister2.tcl /opt/freesurfer/tktools/tkregister.tcl && \
ln -s /opt/freesurfer/bin/tkregister2 /opt/freesurfer/bin/tkregister
# install matlab runtime for freesurfer subnucleic segmentation of hippocampus
RUN fs_install_mcr R2014b
##########################
# cmake for ANTS install
#########################
RUN apt install -y libcurl4-openssl-dev \
libssl-dev
RUN cd /opt/tmp && \
wget https://github.com/Kitware/CMake/releases/download/v3.18.1/cmake-3.18.1.tar.gz && \
tar xz -f cmake-3.18.1.tar.gz && \
rm cmake-3.18.1.tar.gz && \
cd cmake-3.18.1 && \
./configure && \
make && \
make install && \
./bootstrap --prefix=/usr && \
make && \
make install
####################################
# ANTS
###################################
RUN mkdir /opt/ANTScode && \
cd /opt/ANTScode && \
git clone https://github.com/ANTsX/ANTs.git && \
cd ANTs && \
git checkout -f tags/v2.5.0 && \
mkdir /opt/ANTScode/bin && \
cd /opt/ANTScode/bin && \
cmake /opt/ANTScode/ANTs && \
make && \
cd /opt/ANTScode/bin/ANTS-build && \
make install && \
ln -sf /usr/lib/ants/N4BiasFieldCorrection /usr/local/bin/
ENV ANTSPATH=/opt/ANTs/bin
ENV PATH=/opt/ANTScode/ANTs/Scripts:$ANTSPATH:$PATH
ENV ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=4
ENV LD_LIBRARY_PATH=/opt/ANTs/lib:$LD_LIBRARY_PATH
############################################################################################
#
# HCP Workbench
#
###########################################################################################
RUN cd /opt && \
wget https://www.humanconnectome.org/storage/app/media/workbench/workbench-linux64-v1.5.0.zip && \
unzip workbench-linux64-v1.5.0.zip && \
rm workbench-linux64-v1.5.0.zip
ENV PATH=/opt/workbench/bin_linux64:$PATH
#############################
# Core Python Libraries
##############################
# make miniconda the first environment for pythin library consistency
ENV PATH=${MINICONDA_HOME}/bin:${PATH}
RUN pip install nipype==1.8.6 \
nibabel==5.1.0 \
numpy==1.26.1 \
scipy==1.11.3 \
pydicom==2.4.3 \
pybids==0.16.3 \
pandas==2.1.2 \
nilearn==0.10.2 \
nitransforms==23.0.1 \
templateflow==23.1.0 \
xnat==0.5.2 \
matplotlib==3.8.1
############################
# HOME DIRECTORY
###########################
# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000 && \
mkdir -p /home/aacazxnat && \
mkdir -p /etc/sudoers.d && \
echo "aacazxnat:x:${uid}:${gid}:aacazxnat,,,:/home/aacazxnat:/bin/bash" >> /etc/passwd && \
echo "aacazxnat:x:${uid}:" >> /etc/group && \
echo "aacazxnat ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aacazxnat && \
chmod 0440 /etc/sudoers.d/aacazxnat && \
chown ${uid}:${gid} -R /home/aacazxnat
ENV HOME="/home/aacazxnat"
ENV USER=aacazxnat
RUN mkdir -p /home/aacazxnat/matlab
############################
# STARTUP and CLEANUP and CONFIG
###########################
COPY ./src/startup.sh /opt/bin
COPY ./src/license.txt ${FREESURFER_HOME}
COPY ./src/readme /opt/bin
COPY ./src/version /opt/bin
COPY ./src/startup.m /home/aacazxnat/matlab/
ENV PATH=/opt/bin:$PATH
RUN rm -rf /tmp/*
RUN rm -rf /opt/tmp/*
ENV NVIDIA_VISIBLE_DEVICES=all
###############################
# LAST UPDATES - consider moving to correct sections
#
################################
# Add full path to FSLDIR/bin here to avoid conflict with conda above
ENV PATH=${PATH}:$FSLDIR/bin
# add some more bind points
RUN mkdir -p /input /output /work /subjects_dir /rental
# Freesurfer 7.3.2 Patch
ENV FREESURFER=${FREESURFER_HOME}
RUN wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2-patch/mri_sclimbic/mri_sclimbic_seg && \
mv mri_sclimbic_seg $FREESURFER/python/scripts/mri_sclimbic_seg && \
chmod +x $FREESURFER/python/scripts/mri_sclimbic_seg && \
wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2-patch/segment_subregions/core.py && \
mv core.py $FREESURFER/python/packages/freesurfer/subregions && \
wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2-patch/synthsr/mri_synthsr && \
mv mri_synthsr $FREESURFER_HOME/python/scripts/mri_synthsr && \
echo "PlaceMMPialSurf --mm_min_inside 50 --mm_max_inside 200 --mm_min_outside 10 --mm_max_outside 5" > /subjects_dir/global-expert-options.txt
# install correct mcr for freesurfer subregion segmentation
RUN fs_install_mcr R2019b
RUN ldconfig
WORKDIR /opt/work
RUN chmod -R +x /opt/bin
ENTRYPOINT ["/opt/bin/startup.sh"]