Skip to content

Commit df07e84

Browse files
authored
Merge pull request #155 from nipreps/enh/pandoc-conda
MAINT: Refactor Dockerfile with better use of miniconda
2 parents 4f90274 + 00660f3 commit df07e84

File tree

2 files changed

+32
-45
lines changed

2 files changed

+32
-45
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ jobs:
6262
set -e
6363
if [[ "$success" = "0" ]]; then
6464
echo "Pulling from local registry"
65-
docker tag localhost:5000/ubuntu ubuntu:xenial-20191010
65+
docker tag localhost:5000/ubuntu ubuntu:xenial-20201030
6666
docker pull localhost:5000/dmriprep
6767
docker tag localhost:5000/dmriprep nipreps/dmriprep:latest
6868
docker tag localhost:5000/dmriprep nipreps/dmriprep
6969
else
7070
echo "Pulling from Docker Hub"
71-
docker pull ubuntu:xenial-20191010
72-
docker tag ubuntu:xenial-20191010 localhost:5000/ubuntu
71+
docker pull ubuntu:xenial-20201030
72+
docker tag ubuntu:xenial-20201030 localhost:5000/ubuntu
7373
docker push localhost:5000/ubuntu
7474
docker pull nipreps/dmriprep:latest
7575
fi

Dockerfile

Lines changed: 29 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
11
# Use Ubuntu 16.04 LTS
2-
FROM ubuntu:xenial-20191010
3-
4-
# Pre-cache neurodebian key
5-
COPY .docker/neurodebian.gpg /usr/local/etc/neurodebian.gpg
2+
FROM ubuntu:xenial-20201030
63

74
# Prepare environment
85
RUN apt-get update && \
96
apt-get install -y --no-install-recommends \
10-
curl \
7+
autoconf \
8+
build-essential \
119
bzip2 \
1210
ca-certificates \
13-
xvfb \
11+
curl \
1412
cython3 \
15-
build-essential \
16-
autoconf \
13+
git \
1714
libtool \
15+
lsb-release \
1816
pkg-config \
19-
git && \
20-
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
21-
apt-get install -y --no-install-recommends \
22-
nodejs && \
17+
xvfb && \
2318
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2419

25-
# Install latest pandoc
26-
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" && \
27-
dpkg -i pandoc-2.2.2.1-1-amd64.deb && \
28-
rm pandoc-2.2.2.1-1-amd64.deb
29-
3020
# Installing freesurfer
3121
RUN curl -sSL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.1/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.1.tar.gz | tar zxv --no-same-owner -C /opt \
3222
--exclude='freesurfer/diffusion' \
@@ -65,6 +55,8 @@ ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
6555
MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
6656
PATH="$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH"
6757

58+
# Pre-cache neurodebian key
59+
COPY .docker/neurodebian.gpg /usr/local/etc/neurodebian.gpg
6860
# Installing Neurodebian packages (FSL, AFNI, git)
6961
RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \
7062
apt-key add /usr/local/etc/neurodebian.gpg && \
@@ -75,8 +67,7 @@ RUN apt-get update && \
7567
fsl-core=5.0.9-5~nd16.04+1 \
7668
fsl-mni152-templates=5.0.7-2 \
7769
afni=16.2.07~dfsg.1-5~nd16.04+1 \
78-
convert3d \
79-
git-annex-standalone && \
70+
convert3d && \
8071
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
8172

8273
ENV FSLDIR="/usr/share/fsl/5.0" \
@@ -110,14 +101,6 @@ RUN useradd -m -s /bin/bash -G users dmriprep
110101
WORKDIR /home/dmriprep
111102
ENV HOME="/home/dmriprep"
112103

113-
# Installing SVGO
114-
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
115-
RUN apt-get install -y nodejs
116-
RUN npm install -g svgo
117-
118-
# Installing bids-validator
119-
RUN npm install -g [email protected]
120-
121104
# Installing and setting up miniconda
122105
RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \
123106
bash Miniconda3-4.5.11-Linux-x86_64.sh -b -p /usr/local/miniconda && \
@@ -131,18 +114,22 @@ ENV PATH="/usr/local/miniconda/bin:$PATH" \
131114
PYTHONNOUSERSITE=1
132115

133116
# Installing precomputed python packages
134-
RUN conda install -y python=3.7 \
117+
RUN conda install -y -c anaconda -c conda-forge \
118+
python=3.7.1 \
135119
graphviz=2.40 \
120+
git-annex \
136121
libxml2=2.9.8 \
137122
libxslt=1.1.32 \
138123
matplotlib=2.2 \
139124
mkl \
140125
mkl-service \
141-
numpy=1.19 \
126+
nodejs \
127+
numpy=1.20 \
128+
pandoc=2.11 \
142129
pip=20.3 \
143-
setuptools \
144130
scikit-learn=0.19 \
145131
scipy=1.5 \
132+
setuptools=51.1 \
146133
traits=4.6.0 \
147134
zlib; sync && \
148135
chmod -R a+rX /usr/local/miniconda; sync && \
@@ -159,17 +146,18 @@ ENV MKL_NUM_THREADS=1 \
159146
RUN python -c "from matplotlib import font_manager" && \
160147
sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )
161148

162-
# Precaching atlases
163-
COPY setup.cfg dmriprep-setup.cfg
164-
RUN pip install --no-cache-dir "$( grep templateflow dmriprep-setup.cfg | xargs )" && \
165-
python -c "from templateflow import api as tfapi; \
166-
tfapi.get('MNI152NLin6Asym', atlas=None, resolution=[1, 2], extension=['.nii', '.nii.gz']); \
167-
tfapi.get('MNI152NLin2009cAsym', atlas=None, extension=['.nii', '.nii.gz']); \
168-
tfapi.get('OASIS30ANTs', extension=['.nii', '.nii.gz']);" && \
169-
find $HOME/.cache/templateflow -type d -exec chmod go=u {} + && \
170-
find $HOME/.cache/templateflow -type f -exec chmod go=u {} +
171-
172-
# Installing DMRIPREP
149+
# Installing SVGO
150+
RUN npm install -g svgo
151+
152+
# Installing bids-validator
153+
RUN npm install -g [email protected]
154+
155+
# Refresh linked libraries
156+
RUN ldconfig
157+
158+
WORKDIR /src
159+
160+
# Installing dMRIPrep
173161
COPY . /src/dmriprep
174162
ARG VERSION
175163
# Force static versioning within container
@@ -181,7 +169,6 @@ RUN echo "${VERSION}" > /src/dmriprep/dmriprep/VERSION && \
181169
RUN find $HOME -type d -exec chmod go=u {} + && \
182170
find $HOME -type f -exec chmod go=u {} +
183171

184-
RUN ldconfig
185172
WORKDIR /tmp/
186173
ENTRYPOINT ["/usr/local/miniconda/bin/dmriprep"]
187174

0 commit comments

Comments
 (0)