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,11 @@ 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
+ RUN useradd -m -s /bin/bash -G users fmriprep
103
+ WORKDIR /home/fmriprep
104
+ ENV HOME="/home/fmriprep"
105
+
101
106
# Installing SVGO
102
107
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
103
108
RUN apt-get install -y nodejs
@@ -142,41 +147,30 @@ RUN conda install -y python=3.7.1 \
142
147
zlib; sync && \
143
148
chmod -R a+rX /usr/local/miniconda; sync && \
144
149
chmod +x /usr/local/miniconda/bin/*; sync && \
145
- conda clean -- all -y ; sync && \
150
+ conda build purge- all; sync && \
146
151
conda clean -tipsy && sync
147
152
148
- # Precaching fonts, set 'Agg' as default backend for matplotlib
149
- RUN python -c "from matplotlib import font_manager" && \
150
- 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
153
-
154
153
# Unless otherwise specified each process should only use one thread - nipype
155
154
# will handle parallelization
156
155
ENV MKL_NUM_THREADS=1 \
157
156
OMP_NUM_THREADS=1
158
157
158
+ # Precaching fonts, set 'Agg' as default backend for matplotlib
159
+ RUN python -c "from matplotlib import font_manager" && \
160
+ sed -i 's/\( backend *: \) .*$/\1 Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )
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
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
163
+ RUN pip install --no-cache-dir "templateflow>=0.0.5.post1" && \
164
+ python -c "from templateflow import api as tfapi; \
165
+ tfapi.get('MNI152Lin'); \
166
+ tfapi.get('MNI152NLin2009cAsym'); \
167
+ tfapi.get('OASIS30ANTs'); \
168
+ tfapi.get('NKI');"
174
169
175
170
# Installing dev requirements (packages that are not in pypi)
176
171
WORKDIR /src/
177
172
COPY requirements.txt requirements.txt
178
- RUN pip install -r requirements.txt && \
179
- rm -rf ~/.cache/pip
173
+ RUN pip install --no-cache-dir -r requirements.txt
180
174
181
175
# Installing FMRIPREP
182
176
COPY . /src/fmriprep
@@ -185,13 +179,15 @@ ARG VERSION
185
179
RUN echo "${VERSION}" > /src/fmriprep/fmriprep/VERSION && \
186
180
echo "include fmriprep/VERSION" >> /src/fmriprep/MANIFEST.in && \
187
181
cd /src/fmriprep && \
188
- pip install .[all] && \
189
- rm -rf ~/.cache/pip
182
+ pip install --no-cache-dir .[all]
190
183
191
184
RUN install -m 0755 \
192
185
/src/fmriprep/scripts/generate_reference_mask.py \
193
186
/usr/local/bin/generate_reference_mask
194
187
188
+ RUN find $HOME -type d -exec chmod go=u {} + && \
189
+ find $HOME -type f -exec chmod go=u {} +
190
+
195
191
ENV IS_DOCKER_8395080871=1
196
192
197
193
RUN ldconfig
0 commit comments