2
2
FROM ubuntu:xenial-20161213
3
3
4
4
# Pre-cache neurodebian key
5
- COPY docker/files/neurodebian.gpg /root/. neurodebian.gpg
5
+ COPY docker/files/neurodebian.gpg /usr/local/etc/ neurodebian.gpg
6
6
7
7
# Prepare environment
8
8
RUN apt-get update && \
@@ -67,7 +67,7 @@ ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
67
67
68
68
# Installing Neurodebian packages (FSL, AFNI, git)
69
69
RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \
70
- apt-key add /root/. neurodebian.gpg && \
70
+ apt-key add /usr/local/etc/ neurodebian.gpg && \
71
71
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)
72
72
73
73
RUN apt-get update && \
@@ -98,6 +98,10 @@ RUN mkdir -p $ANTSPATH && \
98
98
| tar -xzC $ANTSPATH --strip-components 1
99
99
ENV PATH=$ANTSPATH:$PATH
100
100
101
+ # Create a shared $HOME directory
102
+ WORKDIR /home/fmriprep
103
+ ENV HOME="/home/fmriprep"
104
+
101
105
# Installing SVGO
102
106
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
103
107
RUN apt-get install -y nodejs
@@ -142,41 +146,40 @@ RUN conda install -y python=3.7.1 \
142
146
zlib; sync && \
143
147
chmod -R a+rX /usr/local/miniconda; sync && \
144
148
chmod +x /usr/local/miniconda/bin/*; sync && \
145
- conda clean -- all -y ; sync && \
149
+ conda build purge- all; sync && \
146
150
conda clean -tipsy && sync
147
151
148
152
# Precaching fonts, set 'Agg' as default backend for matplotlib
149
153
RUN python -c "from matplotlib import font_manager" && \
150
154
sed -i 's/\( backend *: \) .*$/\1 Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )
151
- RUN pip install "datalad==0.10.0" && \
152
- rm -rf ~/.cache/pip
155
+ RUN pip install --no-cache-dir "datalad==0.10.0"
153
156
154
157
# Unless otherwise specified each process should only use one thread - nipype
155
158
# will handle parallelization
156
159
ENV MKL_NUM_THREADS=1 \
157
160
OMP_NUM_THREADS=1
158
161
159
162
# Precaching atlases
160
- RUN git config --global user.name "fMRIPrep User" && \
161
- git config --global user.email
"[email protected] "
162
- ENV TEMPLATEFLOW_HOME="/opt/templateflow"
163
- WORKDIR /opt
163
+ WORKDIR /home/fmriprep/.cache
164
164
RUN datalad install -r https://github.com/templateflow/templateflow.git
165
- RUN datalad get $TEMPLATEFLOW_HOME/tpl-MNI152NLin2009cAsym/* \
166
- $TEMPLATEFLOW_HOME/tpl-MNI152Lin/* \
167
- $TEMPLATEFLOW_HOME/tpl-OASIS30ANTs/* \
168
- $TEMPLATEFLOW_HOME/tpl-NKI/*
169
- RUN git -C $TEMPLATEFLOW_HOME config annex.merge-annex-branches false && \
170
- git -C $TEMPLATEFLOW_HOME/tpl-MNI152NLin2009cAsym config annex.merge-annex-branches false && \
171
- git -C $TEMPLATEFLOW_HOME/tpl-MNI152Lin config annex.merge-annex-branches false && \
172
- git -C $TEMPLATEFLOW_HOME/tpl-OASIS30ANTs config annex.merge-annex-branches false && \
173
- git -C $TEMPLATEFLOW_HOME/tpl-NKI config annex.merge-annex-branches false
165
+ WORKDIR /home/fmriprep/.cache/templateflow
166
+ RUN git config user.name "fMRIPrep User" && \
167
+ git config user.email
"[email protected] "
168
+ RUN datalad get tpl-MNI152NLin2009cAsym/* \
169
+ tpl-MNI152Lin/* \
170
+ tpl-OASIS30ANTs/* \
171
+ tpl-NKI/* && \
172
+ rm -rf /home/fmriprep/.cache/datalad
173
+ RUN git -C . config annex.merge-annex-branches false && \
174
+ git -C tpl-MNI152NLin2009cAsym config annex.merge-annex-branches false && \
175
+ git -C tpl-MNI152Lin config annex.merge-annex-branches false && \
176
+ git -C tpl-OASIS30ANTs config annex.merge-annex-branches false && \
177
+ git -C tpl-NKI config annex.merge-annex-branches false
174
178
175
179
# Installing dev requirements (packages that are not in pypi)
176
180
WORKDIR /src/
177
181
COPY requirements.txt requirements.txt
178
- RUN pip install -r requirements.txt && \
179
- rm -rf ~/.cache/pip
182
+ RUN pip install --no-cache-dir -r requirements.txt
180
183
181
184
# Installing FMRIPREP
182
185
COPY . /src/fmriprep
@@ -185,13 +188,15 @@ ARG VERSION
185
188
RUN echo "${VERSION}" > /src/fmriprep/fmriprep/VERSION && \
186
189
echo "include fmriprep/VERSION" >> /src/fmriprep/MANIFEST.in && \
187
190
cd /src/fmriprep && \
188
- pip install .[all] && \
189
- rm -rf ~/.cache/pip
191
+ pip install --no-cache-dir .[all]
190
192
191
193
RUN install -m 0755 \
192
194
/src/fmriprep/scripts/generate_reference_mask.py \
193
195
/usr/local/bin/generate_reference_mask
194
196
197
+ RUN find $HOME -type d -exec chmod go=u {} + && \
198
+ find $HOME -type f -exec chmod go=u {} +
199
+
195
200
ENV IS_DOCKER_8395080871=1
196
201
197
202
RUN ldconfig
0 commit comments