Skip to content

Commit 0c5bf18

Browse files
committed
add Salim's updated Dockerfile
1 parent 9ab0037 commit 0c5bf18

File tree

1 file changed

+158
-127
lines changed

1 file changed

+158
-127
lines changed

Dockerfile

Lines changed: 158 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,23 @@
1-
# Use Ubuntu 16.04 LTS
2-
FROM ubuntu:xenial-20190610
1+
FROM ubuntu:xenial-20161213
32

4-
# Prepare environment
5-
RUN apt-get update && \
6-
apt-get install -y --no-install-recommends \
7-
curl \
8-
bzip2 \
9-
ca-certificates \
10-
xvfb \
11-
cython3 \
12-
build-essential \
13-
autoconf \
14-
libtool \
15-
pkg-config \
16-
git && \
17-
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
18-
apt-get install -y --no-install-recommends \
19-
nodejs && \
20-
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3+
# Used command:
4+
# neurodocker generate docker --base=debian:stretch --pkg-manager=apt
5+
# --ants version=latest method=source --mrtrix3 version=3.0_RC3
6+
# --freesurfer version=6.0.0 method=binaries --fsl version=6.0.1 method=binaries
217

22-
# Getting required installation tools
238
RUN apt-get update && \
249
apt-get install -y --no-install-recommends \
25-
apt-utils \
26-
locales \
27-
unzip \
2810
bc \
11+
libtool \
2912
tar \
3013
dpkg \
14+
curl \
3115
wget \
16+
unzip \
3217
gcc \
18+
git \
3319
libstdc++6
3420

35-
# Neurodocker Setup
3621
ARG DEBIAN_FRONTEND="noninteractive"
3722

3823
ENV LANG="en_US.UTF-8" \
@@ -64,55 +49,73 @@ RUN export ND_ENTRYPOINT="/neurodocker/startup.sh" \
6449

6550
ENTRYPOINT ["/neurodocker/startup.sh"]
6651

67-
# Installing ANTS v2.3.1
68-
ENV ANTSPATH=/opt/ants
69-
RUN mkdir -p $ANTSPATH && \
70-
curl -sSL https://github.com/ANTsX/ANTs/archive/v2.3.1.tar.gz
71-
| tar -xzC $ANTSPATH --strip-components 1
72-
ENV PATH=$ANTSPATH:$PATH
73-
74-
# Installing MRtrix3
75-
ENV PATH="/opt/mrtrix3-3.0_RC3/bin:$PATH"
76-
RUN echo "Downloading MRtrix3 ..." \
77-
&& mkdir -p /opt/mrtrix3-3.0_RC3 \
78-
&& curl -fsSL --retry 5 https://dl.dropbox.com/s/2oh339ehcxcf8xf/mrtrix3-3.0_RC3-Linux-centos6.9-x86_64.tar.gz \
79-
| tar -xz -C /opt/mrtrix3-3.0_RC3 --strip-components 1
80-
81-
# Installing Freesurfer
82-
ENV FREESURFER_HOME="/opt/freesurfer-6.0.0" \
83-
PATH="/opt/freesurfer-6.0.0/bin:$PATH"
84-
RUN apt-get update -qq \
85-
&& apt-get install -y -q --no-install-recommends \
86-
bc \
87-
libgomp1 \
88-
libxmu6 \
89-
libxt6 \
90-
perl \
91-
tcsh \
92-
&& apt-get clean \
93-
&& rm -rf /var/lib/apt/lists/* \
94-
&& echo "Downloading FreeSurfer ..." \
95-
&& mkdir -p /opt/freesurfer-6.0.0 \
96-
&& curl -fsSL --retry 5 ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.0/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0.tar.gz \
97-
| tar -xz -C /opt/freesurfer-6.0.0 --strip-components 1 \
98-
--exclude='freesurfer/average/mult-comp-cor' \
99-
--exclude='freesurfer/lib/cuda' \
100-
--exclude='freesurfer/lib/qt' \
101-
--exclude='freesurfer/subjects/V1_average' \
102-
--exclude='freesurfer/subjects/bert' \
103-
--exclude='freesurfer/subjects/cvs_avg35' \
104-
--exclude='freesurfer/subjects/cvs_avg35_inMNI152' \
105-
--exclude='freesurfer/subjects/fsaverage3' \
106-
--exclude='freesurfer/subjects/fsaverage4' \
107-
--exclude='freesurfer/subjects/fsaverage5' \
108-
--exclude='freesurfer/subjects/fsaverage6' \
109-
--exclude='freesurfer/subjects/fsaverage_sym' \
110-
--exclude='freesurfer/trctrain' \
111-
&& sed -i '$isource "/opt/freesurfer-6.0.0/SetUpFreeSurfer.sh"' "$ND_ENTRYPOINT"
112-
113-
# Installing FSL
52+
# SETUP taken from fmriprep:latest, installs C compiler for ANTS
53+
# Prepare environment
54+
RUN apt-get update && \
55+
apt-get install -y --no-install-recommends \
56+
curl \
57+
bzip2 \
58+
ca-certificates \
59+
xvfb \
60+
cython3 \
61+
build-essential \
62+
autoconf \
63+
libtool \
64+
pkg-config \
65+
git && \
66+
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
67+
apt-get install -y --no-install-recommends \
68+
nodejs && \
69+
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
70+
71+
# Install latest pandoc
72+
RUN curl -o pandoc-2.2.2.1-1-amd64.deb -sSL "https://github.com/jgm/pandoc/releases/download/2.2.2.1/pandoc-2.2.2.1-1-amd64.deb" && \
73+
dpkg -i pandoc-2.2.2.1-1-amd64.deb && \
74+
rm pandoc-2.2.2.1-1-amd64.deb
75+
76+
# ANTS
77+
# from https://github.com/kaczmarj/ANTs-builds/blob/master/Dockerfile
78+
79+
# Get CMake for ANTS
80+
RUN mkdir /cmake_temp
81+
WORKDIR /cmake_temp
82+
RUN wget https://cmake.org/files/v3.12/cmake-3.12.2.tar.gz \
83+
&& tar -xzvf cmake-3.12.2.tar.gz \
84+
&& echo 'done tar' \
85+
&& ls \
86+
&& cd cmake-3.12.2/ \
87+
&& ./bootstrap -- -DCMAKE_BUILD_TYPE:STRING=Release \
88+
&& make -j4 \
89+
&& make install \
90+
&& cd .. \
91+
&& rm -rf *
92+
93+
RUN cmake --version
94+
95+
RUN mkdir /ants
96+
RUN apt-get update && apt-get -y install zlib1g-dev
97+
98+
RUN git clone https://github.com/ANTsX/ANTs.git --branch v2.3.1 /ants
99+
WORKDIR /ants
100+
101+
RUN mkdir build \
102+
&& cd build \
103+
&& git config --global url."https://".insteadOf git:// \
104+
&& cmake .. \
105+
&& make -j1 \
106+
&& mkdir -p /opt/ants \
107+
&& mv bin/* /opt/ants && mv ../Scripts/* /opt/ants \
108+
&& cd .. \
109+
&& rm -rf build
110+
111+
ENV ANTSPATH=/opt/ants/ \
112+
PATH=/opt/ants:$PATH
113+
114+
WORKDIR /
115+
114116
ENV FSLDIR="/opt/fsl-6.0.1" \
115-
PATH="/opt/fsl-6.0.1/bin:$PATH"
117+
PATH="/opt/fsl-6.0.1/bin:$PATH" \
118+
FSLOUTPUTTYPE="NIFTI_GZ"
116119
RUN apt-get update -qq \
117120
&& apt-get install -y -q --no-install-recommends \
118121
bc \
@@ -130,61 +133,58 @@ RUN apt-get update -qq \
130133
libxrandr2 \
131134
libxrender1 \
132135
libxt6 \
136+
python \
133137
wget \
134138
&& apt-get clean \
135139
&& rm -rf /var/lib/apt/lists/* \
136140
&& echo "Downloading FSL ..." \
137-
&& mkdir -p /opt/fsl-6.0.1 \
138-
&& curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.1-centos6_64.tar.gz \
139-
| tar -xz -C /opt/fsl-6.0.1 --strip-components 1 \
140-
&& sed -i '$iecho Some packages in this Docker container are non-free' $ND_ENTRYPOINT \
141-
&& sed -i '$iecho If you are considering commercial use of this container, please consult the relevant license:' $ND_ENTRYPOINT \
142-
&& sed -i '$iecho https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Licence' $ND_ENTRYPOINT \
143-
&& sed -i '$isource $FSLDIR/etc/fslconf/fsl.sh' $ND_ENTRYPOINT
141+
&& wget -q http://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py \
142+
&& chmod 775 fslinstaller.py
143+
RUN /fslinstaller.py -d /opt/fsl-6.0.1 -V 6.0.1 -q
144144

145-
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
146-
RUN apt-get install -y nodejs
147-
RUN npm install -g svgo
145+
# FSL 6.0.1
146+
# Freesurfer 6.0.0
147+
# MRtrix3
148+
# ANTS
149+
# Python 3
148150

149-
# Installing bids-validator
150-
RUN npm install -g [email protected]
151+
# MRtrix3
152+
# from https://hub.docker.com/r/neurology/mrtrix/dockerfile
153+
RUN apt-get update
154+
RUN apt-get install -y --no-install-recommends \
155+
python \
156+
python-numpy \
157+
libeigen3-dev \
158+
clang \
159+
zlib1g-dev \
160+
libqt4-opengl-dev \
161+
libgl1-mesa-dev \
162+
git \
163+
ca-certificates
164+
RUN mkdir /mrtrix
165+
RUN git clone https://github.com/MRtrix3/mrtrix3.git --branch 3.0_RC3 /mrtrix
166+
WORKDIR /mrtrix
167+
# Checkout version used in the lab: 20180128
168+
RUN git checkout f098f097ccbb3e5efbb8f5552f13e0997d161cce
169+
ENV CXX=/usr/bin/clang++
170+
RUN ./configure
171+
RUN ./build
172+
RUN ./set_path
173+
ENV PATH=/mrtrix/bin:$PATH
174+
175+
WORKDIR /
151176

152-
RUN echo '{ \
153-
\n "pkg_manager": "apt", \
154-
\n "instructions": [ \
155-
\n [ \
156-
\n "base", \
157-
\n "debian:stretch" \
158-
\n ], \
159-
\n [ \
160-
\n "ants", \
161-
\n { \
162-
\n "version": "latest", \
163-
\n "method": "source" \
164-
\n } \
165-
\n ], \
166-
\n [ \
167-
\n "mrtrix3", \
168-
\n { \
169-
\n "version": "3.0_RC3" \
170-
\n } \
171-
\n ], \
172-
\n [ \
173-
\n "freesurfer", \
174-
\n { \
175-
\n "version": "6.0.0", \
176-
\n "method": "binaries" \
177-
\n } \
178-
\n ], \
179-
\n [ \
180-
\n "fsl", \
181-
\n { \
182-
\n "version": "6.0.1", \
183-
\n "method": "binaries" \
184-
\n } \
185-
\n ] \
186-
\n ] \
187-
\n}' > /neurodocker/neurodocker_specs.json
177+
# Installing and setting up miniconda
178+
RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \
179+
bash Miniconda3-4.5.11-Linux-x86_64.sh -b -p /usr/local/miniconda && \
180+
rm Miniconda3-4.5.11-Linux-x86_64.sh
181+
182+
# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip)
183+
ENV PATH="/usr/local/miniconda/bin:$PATH" \
184+
CPATH="/usr/local/miniconda/include/:$CPATH" \
185+
LANG="C.UTF-8" \
186+
LC_ALL="C.UTF-8" \
187+
PYTHONNOUSERSITE=1
188188

189189
# add credentials on build
190190
RUN mkdir ~/.ssh && ln -s /run/secrets/host_ssh_key ~/.ssh/id_rsa
@@ -193,12 +193,43 @@ RUN apt-get update && \
193193
apt-get install -y --no-install-recommends \
194194
libopenblas-base
195195

196-
# setting up an install of dmriprep (manual version) inside the container
197-
ADD https://api.github.com/repos/TIGRLab/dmriprep/git/refs/heads/master version.json
198-
RUN git clone -b master https://github.com/TIGRLab/dmriprep.git
199-
#RUN mkdir dmriprep
200-
#COPY ./ dmriprep/
201-
RUN cd dmriprep && ls && python setup.py install && pip list
202-
RUN pip install pybids==0.9.1 && pip list
196+
# Precaching atlases
197+
ENV TEMPLATEFLOW_HOME="/opt/templateflow"
198+
RUN mkdir -p $TEMPLATEFLOW_HOME
199+
RUN pip install --no-cache-dir "templateflow>=0.3.0,<0.4.0a0" && \
200+
python -c "from templateflow import api as tfapi; \
201+
tfapi.get('MNI152NLin6Asym', atlas=None); \
202+
tfapi.get('MNI152NLin2009cAsym', atlas=None); \
203+
tfapi.get('OASIS30ANTs');" && \
204+
find $TEMPLATEFLOW_HOME -type d -exec chmod go=u {} + && \
205+
find $TEMPLATEFLOW_HOME -type f -exec chmod go=u {} +
206+
207+
RUN conda install -y python=3.7.3 \
208+
pip=19.1 \
209+
libxml2=2.9.8 \
210+
libxslt=1.1.32 \
211+
graphviz=2.40.1; sync && \
212+
chmod -R a+rX /usr/local/miniconda; sync && \
213+
chmod +x /usr/local/miniconda/bin/*; sync && \
214+
conda build purge-all; sync && \
215+
conda clean -tipsy && sync
216+
217+
218+
# Setting up an install of dmripreproc (manual version) inside the container
219+
#ADD https://api.github.com/repos/TIGRLab/dmripreproc/git/refs/heads/master version.json
220+
#RUN git clone -b master https://github.com/TIGRLab/dmripreproc.git dmripreproc
221+
222+
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
223+
RUN apt-get install -y nodejs
224+
RUN npm install -g svgo
225+
226+
# Installing bids-validator
227+
RUN npm install -g [email protected]
228+
229+
RUN pip install --upgrade pip
230+
231+
RUN mkdir dmriprep
232+
COPY ./ dmriprep/
233+
RUN cd dmriprep && python setup.py install
203234

204235
ENTRYPOINT ["dmriprep"]

0 commit comments

Comments
 (0)