Skip to content

Commit

Permalink
Reorganize installation steps (#5)
Browse files Browse the repository at this point in the history
* Reorder things a bit.

* Update Dockerfile

* Move conda install to above afni install.
  • Loading branch information
tsalo authored Feb 13, 2023
1 parent 8961b18 commit f5a9204
Showing 1 changed file with 68 additions and 67 deletions.
135 changes: 68 additions & 67 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@

FROM ubuntu:bionic-20220531

COPY docker/files/neurodebian.gpg /usr/local/etc/neurodebian.gpg

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

ENV OS="Linux" \
Expand All @@ -41,14 +41,49 @@ RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca
apt-key add /usr/local/etc/neurodebian.gpg && \
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)


# Install 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 && \
rm Miniconda3-py38_4.9.2-Linux-x86_64.sh

# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip)
ENV PATH="/usr/local/miniconda/bin:$PATH" \
CPATH="/usr/local/miniconda/include:$CPATH" \
LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
PYTHONNOUSERSITE=1

# Install precomputed python packages
RUN conda install -y \
python=3.8 \
libxslt=1.1 \
matplotlib=3.3 \
mkl=2021.2 \
mkl-service=2.3 \
numpy=1.18.1 \
pandas=1.2 \
pip=21.0 \
scikit-learn=0.24 \
scipy=1.6 \
traits=6.2 \
zstd=1.4; \
sync && \
chmod -R a+rX /usr/local/miniconda; sync && \
chmod +x /usr/local/miniconda/bin/*; sync && \
conda clean -y --all; sync && \
conda clean -tipsy; sync && \
rm -rf ~/.conda ~/.cache/pip/*; sync

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
afni=18.0.05+git24-gb25b21054~dfsg.1-1~nd17.10+1+nd18.04+1 \
connectome-workbench=1.5.0-1~nd18.04+1 \
git-annex-standalone && \
afni=18.0.05+git24-gb25b21054~dfsg.1-1~nd17.10+1+nd18.04+1 \
connectome-workbench=1.5.0-1~nd18.04+1 \
git-annex-standalone && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install 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 \
--exclude='freesurfer/diffusion' \
--exclude='freesurfer/docs' \
Expand All @@ -69,80 +104,46 @@ RUN curl -sSL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.1/frees
--exclude='freesurfer/subjects/V1_average' \
--exclude='freesurfer/trctrain'

ENV FSF_OUTPUT_FORMAT="nii.gz" \
FREESURFER_HOME="/opt/freesurfer"

ENV SUBJECTS_DIR="$FREESURFER_HOME/subjects" \
ENV FREESURFER_HOME="/opt/freesurfer" \
FSF_OUTPUT_FORMAT="nii.gz" \
FUNCTIONALS_DIR="$FREESURFER_HOME/sessions" \
MNI_DIR="$FREESURFER_HOME/mni" \
LOCAL_DIR="$FREESURFER_HOME/local" \
MINC_BIN_DIR="$FREESURFER_HOME/mni/bin" \
MINC_LIB_DIR="$FREESURFER_HOME/mni/lib" \
MNI_DIR="$FREESURFER_HOME/mni" \
MNI_DATAPATH="$FREESURFER_HOME/mni/data"

ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \
SUBJECTS_DIR="$FREESURFER_HOME/subjects" \
PATH="$FREESURFER_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH"

ENV AFNI_MODELPATH="/usr/lib/afni/models" \
AFNI_IMSAVE_WARNINGS="NO" \
AFNI_TTATLAS_DATASET="/usr/share/afni/atlases" \
AFNI_PLUGINPATH="/usr/lib/afni/plugins"

ENV PATH="/usr/lib/afni/bin:$PATH"
AFNI_PLUGINPATH="/usr/lib/afni/plugins" \
PATH="/usr/lib/afni/bin:$PATH"


ENV ANTSPATH=/usr/lib/ants
# Install ANTS
ENV ANTSPATH="/usr/lib/ants"
RUN mkdir -p $ANTSPATH && \
curl -sSL "https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz" \
| tar -xzC $ANTSPATH --strip-components 1
ENV PATH=$ANTSPATH:$PATH

# Installing SVGO
# Install SVGO
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g svgo

# Installing bids-validator
# Install bids-validator
RUN npm install -g [email protected]

# 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 && \
rm Miniconda3-py38_4.9.2-Linux-x86_64.sh

# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip)
ENV PATH="/usr/local/miniconda/bin:$PATH" \
CPATH="/usr/local/miniconda/include:$CPATH" \
LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
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.18.1 \
scipy=1.6 \
scikit-learn=0.24 \
matplotlib=3.3 \
pandas=1.2 \
libxslt=1.1 \
traits=6.2 \
zstd=1.4; 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
#RUN pip install numpy==1.18.1
# Unless otherwise specified each process should only use one thread - nipype
# will handle parallelization
ENV MKL_NUM_THREADS=1 \
OMP_NUM_THREADS=1

# Create a shared $HOME directory

RUN useradd -m -s /bin/bash -G users xcp_d
WORKDIR /home/xcp_d
ENV HOME="/home/xcp_d"
Expand All @@ -152,7 +153,7 @@ RUN python -c "from matplotlib import font_manager" && \
sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )

# Precaching atlases: UPDATE TEMPLATEFLOW VERSION TO MATCH XCP_D
RUN pip install --no-cache-dir "templateflow ~= 0.6.1 " && \
RUN pip install --no-cache-dir "templateflow ~= 0.8.1 " && \
python -c "from templateflow import api as tfapi; \
tfapi.get('MNI152NLin2009cAsym', resolution=2, suffix='T1w', desc=None); \
tfapi.get(template='MNI152NLin6Asym',resolution=2, suffix='T1w'); \
Expand Down

0 comments on commit f5a9204

Please sign in to comment.