forked from PennLINC/xcpEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·225 lines (202 loc) · 8.67 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
FROM neurodebian:stretch
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
#ENV CONDA_DIR="/opt/miniconda-latest" \
#PATH="/opt/miniconda-latest/bin:$PATH"
#RUN export PATH="/opt/miniconda-latest/bin:$PATH" \
# && echo "Downloading Miniconda installer ..." \
#&& conda_installer="/tmp/miniconda.sh" \
#&& curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-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 --set auto_update_conda false \
#&& conda config --system --set show_channel_urls true \
#&& sync && conda clean -tipsy && sync \
#&& conda create -y -q --name neuro \
# && conda install -y -q --name neuro \
RUN apt-get update \
&& apt-get install -y python3-pip python3-dev \
&& cd /usr/local/bin \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip
RUN pip install --no-cache-dir numpy pandas traits scikit-learn
RUN pip install --no-cache-dir nipype nibabel niworkflows nilearn matplotlib
RUN rm -rf ~/.cache/pip/* && sync
RUN apt-get update
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 apt-get install -y -q --no-install-recommends procps
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"
ADD . /xcpEngine
RUN bash -c \
'cd /xcpEngine \
&& wget -nv https://upenn.box.com/shared/static/i30llenk6s37kv8nkqxgulwylaxp928g.xz \
&& tar xvfJm i30llenk6s37kv8nkqxgulwylaxp928g.xz \
&& rm i30llenk6s37kv8nkqxgulwylaxp928g.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 XCPEDIR="/xcpEngine" \
AFNI_PATH="/opt/afni-latest/" \
C3D_PATH="/opt/convert3d-nightly/bin/" \
PATH="$PATH:/xcpEngine"
RUN mkdir /data /out /work /design /cohort
ENTRYPOINT ["/xcpEngine/xcpEngine"]