Skip to content

Commit e56151a

Browse files
committed
first revision of general Dockerfile
1 parent 4cbf73d commit e56151a

File tree

1 file changed

+183
-35
lines changed

1 file changed

+183
-35
lines changed

Dockerfile

Lines changed: 183 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,49 +26,197 @@
2626
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2727
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

29-
FROM nipype/testnipypedata:latest
30-
MAINTAINER Stanford Center for Reproducible Neuroscience <[email protected]>
3129

32-
# Preparations
33-
RUN ln -snf /bin/bash /bin/sh
30+
#
31+
# Based on https://github.com/poldracklab/fmriprep/blob/9c92a3de9112f8ef1655b876de060a2ad336ffb0/Dockerfile
32+
#
33+
FROM ubuntu:xenial-20161213
34+
35+
# Prepare environment
36+
RUN apt-get update && \
37+
apt-get install -y --no-install-recommends curl bzip2 ca-certificates xvfb && \
38+
curl -sSL http://neuro.debian.net/lists/xenial.us-ca.full >> /etc/apt/sources.list.d/neurodebian.sources.list && \
39+
apt-key adv --recv-keys --keyserver hkp://pgp.mit.edu:80 0xA5D32F012649A5A9 && \
40+
apt-get update
41+
42+
# Installing freesurfer
43+
RUN curl -sSL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.0/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0.tar.gz | tar zxv -C /opt \
44+
--exclude='freesurfer/trctrain' \
45+
--exclude='freesurfer/subjects/fsaverage_sym' \
46+
--exclude='freesurfer/subjects/fsaverage3' \
47+
--exclude='freesurfer/subjects/fsaverage4' \
48+
--exclude='freesurfer/subjects/fsaverage5' \
49+
--exclude='freesurfer/subjects/fsaverage6' \
50+
--exclude='freesurfer/subjects/cvs_avg35' \
51+
--exclude='freesurfer/subjects/cvs_avg35_inMNI152' \
52+
--exclude='freesurfer/subjects/bert' \
53+
--exclude='freesurfer/subjects/V1_average' \
54+
--exclude='freesurfer/average/mult-comp-cor' \
55+
--exclude='freesurfer/lib/cuda' \
56+
--exclude='freesurfer/lib/qt'
57+
58+
ENV FSL_DIR=/usr/share/fsl/5.0 \
59+
OS=Linux \
60+
FS_OVERRIDE=0 \
61+
FIX_VERTEX_AREA= \
62+
FSF_OUTPUT_FORMAT=nii.gz \
63+
FREESURFER_HOME=/opt/freesurfer
64+
ENV SUBJECTS_DIR=$FREESURFER_HOME/subjects \
65+
FUNCTIONALS_DIR=$FREESURFER_HOME/sessions \
66+
MNI_DIR=$FREESURFER_HOME/mni \
67+
LOCAL_DIR=$FREESURFER_HOME/local \
68+
FSFAST_HOME=$FREESURFER_HOME/fsfast \
69+
MINC_BIN_DIR=$FREESURFER_HOME/mni/bin \
70+
MINC_LIB_DIR=$FREESURFER_HOME/mni/lib \
71+
MNI_DATAPATH=$FREESURFER_HOME/mni/data \
72+
FMRI_ANALYSIS_DIR=$FREESURFER_HOME/fsfast
73+
ENV PERL5LIB=$MINC_LIB_DIR/perl5/5.8.5 \
74+
MNI_PERL5LIB=$MINC_LIB_DIR/perl5/5.8.5 \
75+
PATH=$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH
76+
RUN echo "cHJpbnRmICJrcnp5c3p0b2YuZ29yZ29sZXdza2lAZ21haWwuY29tXG41MTcyXG4gKkN2dW12RVYzelRmZ1xuRlM1Si8yYzFhZ2c0RVxuIiA+IC9vcHQvZnJlZXN1cmZlci9saWNlbnNlLnR4dAo=" | base64 -d | sh
77+
78+
# Installing Neurodebian packages (FSL, AFNI, git)
79+
RUN apt-get install -y --no-install-recommends \
80+
fsl-core=5.0.9-1~nd+1+nd16.04+1 \
81+
afni=16.2.07~dfsg.1-2~nd16.04+1
82+
83+
ENV FSLDIR=/usr/share/fsl/5.0 \
84+
FSLOUTPUTTYPE=NIFTI_GZ \
85+
FSLMULTIFILEQUIT=TRUE \
86+
POSSUMDIR=/usr/share/fsl/5.0 \
87+
LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH \
88+
FSLTCLSH=/usr/bin/tclsh \
89+
FSLWISH=/usr/bin/wish \
90+
AFNI_MODELPATH=/usr/lib/afni/models \
91+
AFNI_IMSAVE_WARNINGS=NO \
92+
AFNI_TTATLAS_DATASET=/usr/share/afni/atlases \
93+
AFNI_PLUGINPATH=/usr/lib/afni/plugins \
94+
PATH=/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH
95+
96+
# Installing and setting up ANTs
97+
RUN mkdir -p /opt/ants && \
98+
curl -sSL "https://github.com/stnava/ANTs/releases/download/v2.1.0/Linux_Ubuntu14.04.tar.bz2" \
99+
| tar -xjC /opt/ants --strip-components 1
100+
101+
ENV ANTSPATH=/opt/ants \
102+
PATH=$ANTSPATH:$PATH
103+
104+
# Installing and setting up c3d
105+
RUN mkdir -p /opt/c3d && \
106+
curl -sSL "http://downloads.sourceforge.net/project/c3d/c3d/1.0.0/c3d-1.0.0-Linux-x86_64.tar.gz" \
107+
| tar -xzC /opt/c3d --strip-components 1
108+
109+
ENV C3DPATH=/opt/c3d/ \
110+
PATH=$C3DPATH/bin:$PATH
111+
112+
# Install some other required tools
113+
ENV apt-get install -y --no-install-recommends \
114+
unzip \
115+
apt-utils \
116+
fusefat \
117+
graphviz \
118+
make \
119+
ruby && \
120+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
121+
122+
# Install fake-S3
123+
ENV GEM_HOME /usr/local/bundle
124+
ENV BUNDLE_PATH="$GEM_HOME" \
125+
BUNDLE_BIN="$GEM_HOME/bin" \
126+
BUNDLE_SILENCE_ROOT_WARNING=1 \
127+
BUNDLE_APP_CONFIG="$GEM_HOME"
128+
ENV PATH $BUNDLE_BIN:$PATH
129+
RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" && \
130+
chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
131+
132+
RUN gem install fakes3
133+
134+
# Install Matlab MCR: from the good old install_spm_mcr.sh of @chrisfilo
135+
WORKDIR /opt
136+
RUN echo "destinationFolder=/opt/mcr" > mcr_options.txt && \
137+
echo "agreeToLicense=yes" >> mcr_options.txt && \
138+
echo "outputFile=/tmp/matlabinstall_log" >> mcr_options.txt && \
139+
echo "mode=silent" >> mcr_options.txt && \
140+
mkdir -p matlab_installer && \
141+
curl -sSL http://www.mathworks.com/supportfiles/downloads/R2015a/deployment_files/R2015a/installers/glnxa64/MCR_R2015a_glnxa64_installer.zip \
142+
-o matlab_installer/installer.zip && \
143+
unzip matlab_installer/installer.zip -d matlab_installer/ && \
144+
matlab_installer/install -inputFile mcr_options.txt && \
145+
rm -rf matlab_installer mcr_options.txt
146+
147+
# Install SPM
148+
RUN curl -sSL http://www.fil.ion.ucl.ac.uk/spm/download/restricted/utopia/dev/spm12_r6472_Linux_R2015a.zip -o spm12.zip && \
149+
unzip spm12.zip && \
150+
rm -rf spm12.zip
151+
152+
ENV MATLABCMD="/opt/mcr/v85/toolbox/matlab" \
153+
SPMMCRCMD="/opt/spm12/run_spm12.sh /opt/mcr/v85/ script" \
154+
FORCE_SPMMCR=1
155+
34156

35-
# Install this branch's code
36-
WORKDIR /root/src
157+
# Installing and setting up miniconda
158+
RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.2.12-Linux-x86_64.sh && \
159+
bash Miniconda3-4.2.12-Linux-x86_64.sh -b -p /usr/local/miniconda && \
160+
rm Miniconda3-4.2.12-Linux-x86_64.sh
37161

38-
# Install matplotlib, sphinx and coverage to build documentation
39-
# and run tests with coverage
40-
RUN source activate nipypetests-2.7 && \
41-
pip install matplotlib sphinx coverage && \
42-
source activate nipypetests-3.4 && \
43-
pip install matplotlib sphinx coverage && \
44-
source activate nipypetests-3.5 && \
45-
pip install matplotlib sphinx coverage
162+
ENV PATH=/usr/local/miniconda/bin:$PATH \
163+
LANG=C.UTF-8 \
164+
LC_ALL=C.UTF-8 \
165+
ACCEPT_INTEL_PYTHON_EULA=yes
46166

47-
ADD . nipype/
167+
# Installing precomputed python packages
168+
RUN conda config --add channels intel && \
169+
conda config --set always_yes yes --set changeps1 no && \
170+
conda update -q conda && \
171+
conda install -y mkl=2017.0.1 \
172+
numpy=1.11.2 \
173+
scipy=0.18.1 \
174+
scikit-learn=0.17.1 \
175+
matplotlib=1.5.3 \
176+
pandas=0.19.0 \
177+
libxml2=2.9.4 \
178+
libxslt=1.1.29 \
179+
traits=4.6.0 \
180+
icu && \
181+
chmod +x /usr/local/miniconda/bin/* && \
182+
conda clean --all -y
48183

49-
# Install the checked out version of nipype, check that requirements are
50-
# installed and install it for each of the three environments.
51-
RUN cd nipype/ && \
52-
source activate nipypetests-2.7 && \
53-
pip install -r requirements.txt && \
54-
pip install -e .
184+
# Precaching fonts
185+
RUN python -c "from matplotlib import font_manager"
55186

56-
RUN cd nipype/ && \
57-
source activate nipypetests-3.4 && \
58-
pip install -r requirements.txt && \
59-
pip install -e .
187+
# Installing Ubuntu packages and cleaning up
188+
RUN apt-get install -y --no-install-recommends \
189+
git=1:2.7.4-0ubuntu1 \
190+
graphviz=2.38.0-12ubuntu2 && \
191+
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
60192

61-
RUN cd nipype/ && \
62-
source activate nipypetests-3.5 && \
63-
pip install -r requirements.txt && \
64-
pip install -e .
193+
# Unless otherwise specified each process should only use one thread - nipype
194+
# will handle parallelization
195+
ENV MKL_NUM_THREADS=1 \
196+
OMP_NUM_THREADS=1
65197

66-
WORKDIR /scratch
198+
# Installing dev requirements (packages that are not in pypi)
199+
WORKDIR /root/
200+
ADD requirements.txt requirements.txt
201+
RUN pip install -r requirements.txt && \
202+
rm -rf ~/.cache/pip
67203

68-
# Install entrypoints
69-
ADD docker/circleci/run_* /usr/bin/
70-
RUN chmod +x /usr/bin/run_*
204+
# Installing nipype
205+
COPY . /root/src/nipype
206+
RUN cd /root/src/nipype && \
207+
pip install -e .[all] && \
208+
rm -rf ~/.cache/pip
71209

72-
# RUN echo 'source /etc/profile.d/nipype_tests.sh' >> /etc/bash.bashrc
73-
ENTRYPOINT ["/usr/bin/run_examples.sh"]
210+
WORKDIR /root/
74211

212+
ARG BUILD_DATE
213+
ARG VCS_REF
214+
ARG VERSION
215+
LABEL org.label-schema.build-date=$BUILD_DATE \
216+
org.label-schema.name="NIPYPE" \
217+
org.label-schema.description="NIPYPE - Neuroimaging in Python: Pipelines and Interfaces" \
218+
org.label-schema.url="http://nipype.readthedocs.io" \
219+
org.label-schema.vcs-ref=$VCS_REF \
220+
org.label-schema.vcs-url="https://github.com/nipy/nipype" \
221+
org.label-schema.version=$VERSION \
222+
org.label-schema.schema-version="1.0"

0 commit comments

Comments
 (0)