Skip to content

Commit

Permalink
Merge pull request #2578 from nipreps/fix/dockerfile-more-anaconda
Browse files Browse the repository at this point in the history
ENH: Stop NeuroDebian dependency in Dockerfile
  • Loading branch information
oesteban authored Oct 7, 2021
2 parents a820912 + 418ae0f commit 3d44335
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 123 deletions.
102 changes: 52 additions & 50 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,27 @@
# Use Ubuntu 20.04 LTS
FROM ubuntu:focal-20210416

# Pre-cache neurodebian key
COPY docker/files/neurodebian.gpg /usr/local/etc/neurodebian.gpg
ENV DEBIAN_FRONTEND="noninteractive" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"

# Prepare environment
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-utils \
curl \
autoconf \
build-essential \
bzip2 \
ca-certificates \
xvfb \
build-essential \
autoconf \
curl \
git \
libtool \
lsb-release \
pkg-config \
graphviz \
pandoc \
pandoc-citeproc \
git && \
curl -sSL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y --no-install-recommends \
nodejs && \
unzip \
xvfb && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV DEBIAN_FRONTEND="noninteractive" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"

# Installing freesurfer
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 \
Expand Down Expand Up @@ -92,16 +86,6 @@ ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
PATH="$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH"

# Installing Neurodebian packages
RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \
apt-key add /usr/local/etc/neurodebian.gpg && \
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
connectome-workbench=1.5.0-1~nd20.04+1 \
git-annex-standalone=8.20210903-1~ndall+1 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# FSL 5.0.11 (neurodocker build)
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
Expand Down Expand Up @@ -250,17 +234,14 @@ ENV PATH="/opt/afni-latest:$PATH" \
AFNI_IMSAVE_WARNINGS="NO" \
AFNI_PLUGINPATH="/opt/afni-latest"

# Installing ANTs 2.3.4 (NeuroDocker build)
ENV ANTSPATH="/usr/lib/ants" \
PATH="/usr/lib/ants:$PATH"
# Installing ANTs 2.3.3 (NeuroDocker build)
# Note: the URL says 2.3.4 but it is actually 2.3.3
ENV ANTSPATH="/opt/ants" \
PATH="/opt/ants:$PATH"
WORKDIR $ANTSPATH
RUN curl -sSL "https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz" \
| tar -xzC $ANTSPATH --strip-components 1

# Installing SVGO and bids-validator
RUN npm install -g svgo@^2.3 bids-validator@1.8.0 \
&& rm -rf ~/.npm ~/.empty /root/.npm

# Installing and setting up ICA_AROMA
WORKDIR /opt/ICA-AROMA
RUN curl -sSL "https://github.com/oesteban/ICA-AROMA/archive/v0.4.5.tar.gz" \
Expand All @@ -269,6 +250,17 @@ RUN curl -sSL "https://github.com/oesteban/ICA-AROMA/archive/v0.4.5.tar.gz" \
ENV PATH="/opt/ICA-AROMA:$PATH" \
AROMA_VERSION="0.4.5"

WORKDIR /opt
RUN curl -sSLO https://www.humanconnectome.org/storage/app/media/workbench/workbench-linux64-v1.5.0.zip && \
unzip workbench-linux64-v1.5.0.zip && \
rm workbench-linux64-v1.5.0.zip && \
rm -rf /opt/workbench/libs_linux64_software_opengl /opt/workbench/plugins_linux64 && \
strip --remove-section=.note.ABI-tag /opt/workbench/libs_linux64/libQt5Core.so.5
# ABI tags can interfere when running on Singularity

ENV PATH="/opt/workbench/bin_linux64:$PATH" \
LD_LIBRARY_PATH="/opt/workbench/lib_linux64:$LD_LIBRARY_PATH"

# Installing and setting up miniconda
RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-py38_4.9.2-Linux-x86_64.sh && \
bash Miniconda3-py38_4.9.2-Linux-x86_64.sh -b -p /usr/local/miniconda && \
Expand All @@ -282,38 +274,50 @@ ENV PATH="/usr/local/miniconda/bin:$PATH" \
PYTHONNOUSERSITE=1

# Installing precomputed python packages
RUN conda install -y python=3.8 \
pip=21.0 \
mkl=2021.2 \
mkl-service=2.3 \
numpy=1.20 \
scipy=1.6 \
scikit-learn=0.24 \
scikit-image=0.18 \
RUN conda install -y -c conda-forge -c anaconda \
python=3.8 \
git-annex=*=alldep* \
graphviz=2.49 \
libxml2=2.9 \
libxslt=1.1 \
matplotlib=3.3 \
mkl-service=2.4 \
mkl=2021.3 \
nodejs=16 \
numpy=1.20 \
pandas=1.2 \
libxslt=1.1 \
pandoc=2.14 \
pip=21.2 \
scikit-image=0.18 \
scikit-learn=0.24 \
scipy=1.6 \
setuptools=58.2 \
traits=6.2 \
zstd=1.4; sync && \
zlib=1.2 \
zstd=1.5; sync && \
chmod -R a+rX /usr/local/miniconda; sync && \
chmod +x /usr/local/miniconda/bin/*; sync && \
conda clean -y --all && sync && \
rm -rf ~/.conda ~/.cache/pip/*; sync

# Precaching fonts, set 'Agg' as default backend for matplotlib
RUN python -c "from matplotlib import font_manager" && \
sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )

# Unless otherwise specified each process should only use one thread - nipype
# will handle parallelization
ENV MKL_NUM_THREADS=1 \
OMP_NUM_THREADS=1

# Installing SVGO and bids-validator
RUN npm install -g svgo@^2.3 bids-validator@1.8.0 \
&& rm -rf ~/.npm ~/.empty /root/.npm

# Create a shared $HOME directory
RUN useradd -m -s /bin/bash -G users fmriprep
WORKDIR /home/fmriprep
ENV HOME="/home/fmriprep"

# Precaching fonts, set 'Agg' as default backend for matplotlib
RUN python -c "from matplotlib import font_manager" && \
sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )

# Precaching atlases
COPY scripts/fetch_templates.py fetch_templates.py

Expand All @@ -337,8 +341,6 @@ RUN find $HOME -type d -exec chmod go=u {} + && \

ENV IS_DOCKER_8395080871=1

# ABI tags can interfere when running on Singularity
RUN strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
RUN ldconfig
WORKDIR /tmp
ENTRYPOINT ["/usr/local/miniconda/bin/fmriprep"]
Expand Down
71 changes: 0 additions & 71 deletions docker/files/neurodebian.gpg

This file was deleted.

3 changes: 1 addition & 2 deletions fmriprep/cli/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ def build_boilerplate(config_file, workflow):
"-s",
"--bibliography",
pkgrf("fmriprep", "data/boilerplate.bib"),
"--filter",
"pandoc-citeproc",
"--citeproc",
"--metadata",
'pagetitle="fMRIPrep citation boilerplate"',
str(citation_files["md"]),
Expand Down

0 comments on commit 3d44335

Please sign in to comment.