forked from PennLINC/xcpEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Singularity
292 lines (267 loc) · 8.1 KB
/
Singularity
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
# Generated by Neurodocker version 0.4.1-9-g1f6df59
# Timestamp: 2018-08-14 18:18: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/kaczmarj/neurodocker
Bootstrap: docker
From: neurodebian:stretch
%post
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/* /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"
echo 'set -e' >> "$ND_ENTRYPOINT"
echo 'if [ -n "$1" ]; then "$@"; else /usr/bin/env bash; fi' >> "$ND_ENTRYPOINT";
fi
chmod -R 777 /neurodocker && chmod a+s /neurodocker
apt-get update -qq
apt-get install -y -q --no-install-recommends \
wget
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
apt-get update -qq
apt-get install -y -q --no-install-recommends \
bc \
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.11
curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-5.0.11-centos6_64.tar.gz \
| tar -xz -C /opt/fsl-5.0.11 --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.11/etc/fslconf/fslpython_install.sh -f /opt/fsl-5.0.11
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
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/toinstall.deb http://mirrors.kernel.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb
dpkg -i /tmp/toinstall.deb
rm /tmp/toinstall.deb
curl -sSL --retry 5 -o /tmp/toinstall.deb http://mirrors.kernel.org/debian/pool/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/* /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
echo "Downloading ANTs ..."
mkdir -p /opt/ants-2.2.0
curl -fsSL --retry 5 https://dl.dropbox.com/s/2f4sui1z6lcgyek/ANTs-Linux-centos5_x86_64-v2.2.0-0740f91.tar.gz \
| tar -xz -C /opt/ants-2.2.0 --strip-components 1
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
sed -i '$iexport XCPEDIR=/xcpEngine-master' $ND_ENTRYPOINT
sed -i '$iexport FSLDIR=/opt/fsl-5.0.11' $ND_ENTRYPOINT
sed -i '$iexport AFNI_PATH=/opt/afni-latest' $ND_ENTRYPOINT
sed -i '$iexport C3D_PATH=/opt/convert3d-nightly/bin' $ND_ENTRYPOINT
sed -i '$iexport ANTSPATH=/opt/ants-2.2.0' $ND_ENTRYPOINT
sed -i '$iexport PATH=$PATH:$XCPEDIR' $ND_ENTRYPOINT
bash -c 'cd / && wget https://github.com/PennBBL/xcpEngine/archive/master.zip && unzip master.zip'
bash -c 'XCPEDIR=/xcpEngine-master FSLDIR=/opt/fsl-5.0.11 AFNI_PATH=/opt/afni-latest C3D_PATH=/opt/convert3d-nightly/bin ANTSPATH=/opt/ants-2.2.0 /xcpEngine-master/xcpReset'
bash -c 'export PATH=/opt/afni-latest:$PATH && rPkgsInstall -pkgs ALL && rPkgsInstall -pkgs optparse,pracma,RNifti,svglite,signal,reshape2,ggplot2,lme4'
bash -c ' echo =========================='
bash -c 'cat $ND_ENTRYPOINT'
bash -c ' echo =========================='
echo '{
\n "pkg_manager": "apt",
\n "instructions": [
\n [
\n "base",
\n "neurodebian:stretch"
\n ],
\n [
\n "_header",
\n {
\n "version": "generic",
\n "method": "custom"
\n }
\n ],
\n [
\n "install",
\n [
\n "wget"
\n ]
\n ],
\n [
\n "fsl",
\n {
\n "version": "5.0.11"
\n }
\n ],
\n [
\n "convert3d",
\n {
\n "version": "1.0.0",
\n "method": "binaries"
\n }
\n ],
\n [
\n "afni",
\n {
\n "version": "latest",
\n "install_r": "true",
\n "install_r_pkgs": "true"
\n }
\n ],
\n [
\n "ants",
\n {
\n "version": "2.2.0"
\n }
\n ],
\n [
\n "convert3d",
\n {
\n "version": "nightly"
\n }
\n ],
\n [
\n "env",
\n {
\n "XCPEDIR": "/xcpEngine-master",
\n "FSLDIR": "/opt/fsl-5.0.11",
\n "AFNI_PATH": "/opt/afni-latest",
\n "C3D_PATH": "/opt/convert3d-nightly/bin"
\n }
\n ],
\n [
\n "add_to_entrypoint",
\n "export XCPEDIR=/xcpEngine-master"
\n ],
\n [
\n "add_to_entrypoint",
\n "export FSLDIR=/opt/fsl-5.0.11"
\n ],
\n [
\n "add_to_entrypoint",
\n "export AFNI_PATH=/opt/afni-latest"
\n ],
\n [
\n "add_to_entrypoint",
\n "export C3D_PATH=/opt/convert3d-nightly/bin"
\n ],
\n [
\n "add_to_entrypoint",
\n "export ANTSPATH=/opt/ants-2.2.0"
\n ],
\n [
\n "add_to_entrypoint",
\n "export PATH=$PATH:$XCPEDIR"
\n ],
\n [
\n "run_bash",
\n "cd / && wget https://github.com/PennBBL/xcpEngine/archive/master.zip && unzip master.zip"
\n ],
\n [
\n "run_bash",
\n "XCPEDIR=/xcpEngine-master FSLDIR=/opt/fsl-5.0.11 AFNI_PATH=/opt/afni-latest C3D_PATH=/opt/convert3d-nightly/bin ANTSPATH=/opt/ants-2.2.0 /xcpEngine-master/xcpReset"
\n ],
\n [
\n "run_bash",
\n "export PATH=/opt/afni-latest:$PATH && rPkgsInstall -pkgs ALL && rPkgsInstall -pkgs optparse,pracma,RNifti,svglite,signal,reshape2,ggplot2,lme4"
\n ],
\n [
\n "run_bash",
\n " echo =========================="
\n ],
\n [
\n "run_bash",
\n "cat $ND_ENTRYPOINT"
\n ],
\n [
\n "run_bash",
\n " echo =========================="
\n ],
\n [
\n "entrypoint",
\n "/neurodocker/startup.sh /xcpEngine-master/xcpEngine \"$@\""
\n ]
\n ]
\n}' > /neurodocker/neurodocker_specs.json
%environment
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export ND_ENTRYPOINT="/neurodocker/startup.sh"
export FSLDIR="/opt/fsl-5.0.11"
export PATH="/opt/fsl-5.0.11/bin:$PATH"
export C3DPATH="/opt/convert3d-1.0.0"
export PATH="/opt/convert3d-1.0.0/bin:$PATH"
export PATH="/opt/afni-latest:$PATH"
export AFNI_PLUGINPATH="/opt/afni-latest"
export ANTSPATH="/opt/ants-2.2.0"
export PATH="/opt/ants-2.2.0:$PATH"
export C3DPATH="/opt/convert3d-nightly"
export PATH="/opt/convert3d-nightly/bin:$PATH"
export XCPEDIR="/xcpEngine-master"
export FSLDIR="/opt/fsl-5.0.11"
export AFNI_PATH="/opt/afni-latest"
export C3D_PATH="/opt/convert3d-nightly/bin"
%runscript
/neurodocker/startup.sh /xcpEngine-master/xcpEngine "$@"