|
| 1 | +# Use Ubuntu 16.04 LTS |
| 2 | +FROM ubuntu:xenial-20161213 |
| 3 | + |
| 4 | +# Pre-cache neurodebian key |
| 5 | +COPY .docker/neurodebian.gpg /usr/local/etc/neurodebian.gpg |
| 6 | + |
| 7 | +# Prepare environment |
| 8 | +RUN apt-get update && \ |
| 9 | + apt-get install -y --no-install-recommends \ |
| 10 | + curl \ |
| 11 | + bzip2 \ |
| 12 | + ca-certificates \ |
| 13 | + xvfb \ |
| 14 | + cython3 \ |
| 15 | + build-essential \ |
| 16 | + autoconf \ |
| 17 | + libtool \ |
| 18 | + 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 && \ |
| 23 | + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 24 | + |
| 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 | + |
| 30 | +# Installing freesurfer |
| 31 | +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 \ |
| 32 | + --exclude='freesurfer/diffusion' \ |
| 33 | + --exclude='freesurfer/docs' \ |
| 34 | + --exclude='freesurfer/fsfast' \ |
| 35 | + --exclude='freesurfer/lib/cuda' \ |
| 36 | + --exclude='freesurfer/lib/qt' \ |
| 37 | + --exclude='freesurfer/matlab' \ |
| 38 | + --exclude='freesurfer/mni/share/man' \ |
| 39 | + --exclude='freesurfer/subjects/fsaverage_sym' \ |
| 40 | + --exclude='freesurfer/subjects/fsaverage3' \ |
| 41 | + --exclude='freesurfer/subjects/fsaverage4' \ |
| 42 | + --exclude='freesurfer/subjects/cvs_avg35' \ |
| 43 | + --exclude='freesurfer/subjects/cvs_avg35_inMNI152' \ |
| 44 | + --exclude='freesurfer/subjects/bert' \ |
| 45 | + --exclude='freesurfer/subjects/lh.EC_average' \ |
| 46 | + --exclude='freesurfer/subjects/rh.EC_average' \ |
| 47 | + --exclude='freesurfer/subjects/sample-*.mgz' \ |
| 48 | + --exclude='freesurfer/subjects/V1_average' \ |
| 49 | + --exclude='freesurfer/trctrain' |
| 50 | + |
| 51 | +ENV FSL_DIR="/usr/share/fsl/5.0" \ |
| 52 | + OS="Linux" \ |
| 53 | + FS_OVERRIDE=0 \ |
| 54 | + FIX_VERTEX_AREA="" \ |
| 55 | + FSF_OUTPUT_FORMAT="nii.gz" \ |
| 56 | + FREESURFER_HOME="/opt/freesurfer" |
| 57 | +ENV SUBJECTS_DIR="$FREESURFER_HOME/subjects" \ |
| 58 | + FUNCTIONALS_DIR="$FREESURFER_HOME/sessions" \ |
| 59 | + MNI_DIR="$FREESURFER_HOME/mni" \ |
| 60 | + LOCAL_DIR="$FREESURFER_HOME/local" \ |
| 61 | + MINC_BIN_DIR="$FREESURFER_HOME/mni/bin" \ |
| 62 | + MINC_LIB_DIR="$FREESURFER_HOME/mni/lib" \ |
| 63 | + MNI_DATAPATH="$FREESURFER_HOME/mni/data" |
| 64 | +ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \ |
| 65 | + MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \ |
| 66 | + PATH="$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH" |
| 67 | + |
| 68 | +# Installing Neurodebian packages (FSL, AFNI, git) |
| 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 /usr/local/etc/neurodebian.gpg && \ |
| 71 | + (apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true) |
| 72 | + |
| 73 | +RUN apt-get update && \ |
| 74 | + apt-get install -y --no-install-recommends \ |
| 75 | + fsl-core=5.0.9-5~nd16.04+1 \ |
| 76 | + fsl-mni152-templates=5.0.7-2 \ |
| 77 | + afni=16.2.07~dfsg.1-5~nd16.04+1 \ |
| 78 | + convert3d \ |
| 79 | + git-annex-standalone && \ |
| 80 | + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 81 | + |
| 82 | +ENV FSLDIR="/usr/share/fsl/5.0" \ |
| 83 | + FSLOUTPUTTYPE="NIFTI_GZ" \ |
| 84 | + FSLMULTIFILEQUIT="TRUE" \ |
| 85 | + POSSUMDIR="/usr/share/fsl/5.0" \ |
| 86 | + LD_LIBRARY_PATH="/usr/lib/fsl/5.0:$LD_LIBRARY_PATH" \ |
| 87 | + FSLTCLSH="/usr/bin/tclsh" \ |
| 88 | + FSLWISH="/usr/bin/wish" \ |
| 89 | + AFNI_MODELPATH="/usr/lib/afni/models" \ |
| 90 | + AFNI_IMSAVE_WARNINGS="NO" \ |
| 91 | + AFNI_TTATLAS_DATASET="/usr/share/afni/atlases" \ |
| 92 | + AFNI_PLUGINPATH="/usr/lib/afni/plugins" |
| 93 | +ENV PATH="/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH" |
| 94 | + |
| 95 | +# Installing ANTs 2.2.0 (NeuroDocker build) |
| 96 | +ENV ANTSPATH=/usr/lib/ants |
| 97 | +RUN mkdir -p $ANTSPATH && \ |
| 98 | + curl -sSL "https://dl.dropbox.com/s/2f4sui1z6lcgyek/ANTs-Linux-centos5_x86_64-v2.2.0-0740f91.tar.gz" \ |
| 99 | + | tar -xzC $ANTSPATH --strip-components 1 |
| 100 | +ENV PATH=$ANTSPATH:$PATH |
| 101 | + |
| 102 | +# Create a shared $HOME directory |
| 103 | +RUN useradd -m -s /bin/bash -G users dmriprep |
| 104 | +WORKDIR /home/dmriprep |
| 105 | +ENV HOME="/home/dmriprep" |
| 106 | + |
| 107 | +# Installing SVGO |
| 108 | +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - |
| 109 | +RUN apt-get install -y nodejs |
| 110 | +RUN npm install -g svgo |
| 111 | + |
| 112 | +# Installing bids-validator |
| 113 | +RUN npm install -g [email protected] |
| 114 | + |
| 115 | +# Installing and setting up ICA_AROMA |
| 116 | +RUN mkdir -p /opt/ICA-AROMA && \ |
| 117 | + curl -sSL "https://github.com/maartenmennes/ICA-AROMA/archive/v0.4.4-beta.tar.gz" \ |
| 118 | + | tar -xzC /opt/ICA-AROMA --strip-components 1 && \ |
| 119 | + chmod +x /opt/ICA-AROMA/ICA_AROMA.py |
| 120 | + |
| 121 | +ENV PATH=/opt/ICA-AROMA:$PATH |
| 122 | + |
| 123 | +# Installing and setting up miniconda |
| 124 | +RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \ |
| 125 | + bash Miniconda3-4.5.11-Linux-x86_64.sh -b -p /usr/local/miniconda && \ |
| 126 | + rm Miniconda3-4.5.11-Linux-x86_64.sh |
| 127 | + |
| 128 | +# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip) |
| 129 | +ENV PATH="/usr/local/miniconda/bin:$PATH" \ |
| 130 | + CPATH="/usr/local/miniconda/include/:$CPATH" \ |
| 131 | + LANG="C.UTF-8" \ |
| 132 | + LC_ALL="C.UTF-8" \ |
| 133 | + PYTHONNOUSERSITE=1 |
| 134 | + |
| 135 | +# Installing precomputed python packages |
| 136 | +RUN conda install -y python=3.7.1 \ |
| 137 | + pip=19.1 \ |
| 138 | + mkl=2018.0.3 \ |
| 139 | + mkl-service \ |
| 140 | + numpy=1.15.4 \ |
| 141 | + scipy=1.1.0 \ |
| 142 | + scikit-learn=0.19.1 \ |
| 143 | + matplotlib=2.2.2 \ |
| 144 | + pandas=0.23.4 \ |
| 145 | + libxml2=2.9.8 \ |
| 146 | + libxslt=1.1.32 \ |
| 147 | + graphviz=2.40.1 \ |
| 148 | + traits=4.6.0 \ |
| 149 | + zlib; sync && \ |
| 150 | + chmod -R a+rX /usr/local/miniconda; sync && \ |
| 151 | + chmod +x /usr/local/miniconda/bin/*; sync && \ |
| 152 | + conda build purge-all; sync && \ |
| 153 | + conda clean -tipsy && sync |
| 154 | + |
| 155 | +# Unless otherwise specified each process should only use one thread - nipype |
| 156 | +# will handle parallelization |
| 157 | +ENV MKL_NUM_THREADS=1 \ |
| 158 | + OMP_NUM_THREADS=1 |
| 159 | + |
| 160 | +# Precaching fonts, set 'Agg' as default backend for matplotlib |
| 161 | +RUN python -c "from matplotlib import font_manager" && \ |
| 162 | + sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" ) |
| 163 | + |
| 164 | +# Precaching atlases |
| 165 | +RUN pip install --no-cache-dir "templateflow>=0.4.0,<0.5.0a0" && \ |
| 166 | + python -c "from templateflow import api as tfapi; \ |
| 167 | + tfapi.get('MNI152NLin6Asym', atlas=None, extension=['.nii', '.nii.gz']); \ |
| 168 | + tfapi.get('MNI152NLin2009cAsym', atlas=None, extension=['.nii', '.nii.gz']); \ |
| 169 | + tfapi.get('OASIS30ANTs', extension=['.nii', '.nii.gz']);" && \ |
| 170 | + find $HOME/.cache/templateflow -type d -exec chmod go=u {} + && \ |
| 171 | + find $HOME/.cache/templateflow -type f -exec chmod go=u {} + |
| 172 | + |
| 173 | +# Installing FMRIPREP |
| 174 | +COPY . /src/dmriprep |
| 175 | +ARG VERSION |
| 176 | +# Force static versioning within container |
| 177 | +RUN echo "${VERSION}" > /src/dmriprep/dmriprep/VERSION && \ |
| 178 | + echo "include dmriprep/VERSION" >> /src/dmriprep/MANIFEST.in && \ |
| 179 | + pip install --no-cache-dir "/src/dmriprep[all]" |
| 180 | + |
| 181 | +RUN find $HOME -type d -exec chmod go=u {} + && \ |
| 182 | + find $HOME -type f -exec chmod go=u {} + |
| 183 | + |
| 184 | +ENV IS_DOCKER_8395080871=1 |
| 185 | + |
| 186 | +RUN ldconfig |
| 187 | +WORKDIR /tmp/ |
| 188 | +ENTRYPOINT ["/usr/local/miniconda/bin/dmriprep"] |
| 189 | + |
| 190 | +ARG BUILD_DATE |
| 191 | +ARG VCS_REF |
| 192 | +ARG VERSION |
| 193 | +LABEL org.label-schema.build-date=$BUILD_DATE \ |
| 194 | + org.label-schema.name="dMRIPrep" \ |
| 195 | + org.label-schema.description="dMRIPrep - robust dMRI preprocessing tool" \ |
| 196 | + org.label-schema.url="http://dmriprep.org" \ |
| 197 | + org.label-schema.vcs-ref=$VCS_REF \ |
| 198 | + org.label-schema.vcs-url="https://github.com/nipreps/dmriprep" \ |
| 199 | + org.label-schema.version=$VERSION \ |
| 200 | + org.label-schema.schema-version="1.0" |
0 commit comments