|
| 1 | +FROM ubuntu:xenial-20200114 |
| 2 | + |
| 3 | +# Pre-cache neurodebian key |
| 4 | +COPY docker/files/neurodebian.gpg /usr/local/etc/neurodebian.gpg |
| 5 | + |
| 6 | +# Prepare environment |
| 7 | +RUN apt-get update && \ |
| 8 | + apt-get install -y --no-install-recommends \ |
| 9 | + curl \ |
| 10 | + bzip2 \ |
| 11 | + ca-certificates \ |
| 12 | + xvfb \ |
| 13 | + build-essential \ |
| 14 | + autoconf \ |
| 15 | + libtool \ |
| 16 | + pkg-config \ |
| 17 | + git && \ |
| 18 | + curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ |
| 19 | + apt-get install -y --no-install-recommends \ |
| 20 | + nodejs && \ |
| 21 | + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 22 | + |
| 23 | +# Installing freesurfer |
| 24 | +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 \ |
| 25 | + --exclude='freesurfer/diffusion' \ |
| 26 | + --exclude='freesurfer/docs' \ |
| 27 | + --exclude='freesurfer/fsfast' \ |
| 28 | + --exclude='freesurfer/lib/cuda' \ |
| 29 | + --exclude='freesurfer/lib/qt' \ |
| 30 | + --exclude='freesurfer/matlab' \ |
| 31 | + --exclude='freesurfer/mni/share/man' \ |
| 32 | + --exclude='freesurfer/subjects/fsaverage_sym' \ |
| 33 | + --exclude='freesurfer/subjects/fsaverage3' \ |
| 34 | + --exclude='freesurfer/subjects/fsaverage4' \ |
| 35 | + --exclude='freesurfer/subjects/cvs_avg35' \ |
| 36 | + --exclude='freesurfer/subjects/cvs_avg35_inMNI152' \ |
| 37 | + --exclude='freesurfer/subjects/bert' \ |
| 38 | + --exclude='freesurfer/subjects/lh.EC_average' \ |
| 39 | + --exclude='freesurfer/subjects/rh.EC_average' \ |
| 40 | + --exclude='freesurfer/subjects/sample-*.mgz' \ |
| 41 | + --exclude='freesurfer/subjects/V1_average' \ |
| 42 | + --exclude='freesurfer/trctrain' |
| 43 | + |
| 44 | +ENV FSL_DIR="/usr/share/fsl/5.0" \ |
| 45 | + OS="Linux" \ |
| 46 | + FS_OVERRIDE=0 \ |
| 47 | + FIX_VERTEX_AREA="" \ |
| 48 | + FSF_OUTPUT_FORMAT="nii.gz" \ |
| 49 | + FREESURFER_HOME="/opt/freesurfer" |
| 50 | +ENV SUBJECTS_DIR="$FREESURFER_HOME/subjects" \ |
| 51 | + FUNCTIONALS_DIR="$FREESURFER_HOME/sessions" \ |
| 52 | + MNI_DIR="$FREESURFER_HOME/mni" \ |
| 53 | + LOCAL_DIR="$FREESURFER_HOME/local" \ |
| 54 | + MINC_BIN_DIR="$FREESURFER_HOME/mni/bin" \ |
| 55 | + MINC_LIB_DIR="$FREESURFER_HOME/mni/lib" \ |
| 56 | + MNI_DATAPATH="$FREESURFER_HOME/mni/data" |
| 57 | +ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \ |
| 58 | + MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \ |
| 59 | + PATH="$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH" |
| 60 | + |
| 61 | +# Installing Neurodebian packages (FSL, AFNI, git) |
| 62 | +RUN curl -sSL "http://neuro.debian.net/lists/$( lsb_release -c | cut -f2 ).us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \ |
| 63 | + apt-key add /usr/local/etc/neurodebian.gpg && \ |
| 64 | + (apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true) |
| 65 | + |
| 66 | +RUN apt-get update && \ |
| 67 | + apt-get install -y --no-install-recommends \ |
| 68 | + fsl-core=5.0.9-5~nd16.04+1 \ |
| 69 | + fsl-mni152-templates=5.0.7-2 \ |
| 70 | + afni=16.2.07~dfsg.1-5~nd16.04+1 \ |
| 71 | + convert3d \ |
| 72 | + connectome-workbench=1.3.2-2~nd16.04+1 \ |
| 73 | + git-annex-standalone && \ |
| 74 | + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 75 | + |
| 76 | +ENV FSLDIR="/usr/share/fsl/5.0" \ |
| 77 | + FSLOUTPUTTYPE="NIFTI_GZ" \ |
| 78 | + FSLMULTIFILEQUIT="TRUE" \ |
| 79 | + POSSUMDIR="/usr/share/fsl/5.0" \ |
| 80 | + LD_LIBRARY_PATH="/usr/lib/fsl/5.0:$LD_LIBRARY_PATH" \ |
| 81 | + FSLTCLSH="/usr/bin/tclsh" \ |
| 82 | + FSLWISH="/usr/bin/wish" \ |
| 83 | + AFNI_MODELPATH="/usr/lib/afni/models" \ |
| 84 | + AFNI_IMSAVE_WARNINGS="NO" \ |
| 85 | + AFNI_TTATLAS_DATASET="/usr/share/afni/atlases" \ |
| 86 | + AFNI_PLUGINPATH="/usr/lib/afni/plugins" |
| 87 | +ENV PATH="/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH" |
| 88 | + |
| 89 | +# Installing ANTs 2.2.0 (NeuroDocker build) |
| 90 | +ENV ANTSPATH=/usr/lib/ants |
| 91 | +RUN mkdir -p $ANTSPATH && \ |
| 92 | + curl -sSL "https://dl.dropbox.com/s/2f4sui1z6lcgyek/ANTs-Linux-centos5_x86_64-v2.2.0-0740f91.tar.gz" \ |
| 93 | + | tar -xzC $ANTSPATH --strip-components 1 |
| 94 | +ENV PATH=$ANTSPATH:$PATH |
| 95 | + |
| 96 | +# Installing and setting up miniconda |
| 97 | +RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \ |
| 98 | + bash Miniconda3-4.5.11-Linux-x86_64.sh -b -p /usr/local/miniconda && \ |
| 99 | + rm Miniconda3-4.5.11-Linux-x86_64.sh |
| 100 | + |
| 101 | +# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip) |
| 102 | +ENV PATH="/usr/local/miniconda/bin:$PATH" \ |
| 103 | + CPATH="/usr/local/miniconda/include/:$CPATH" \ |
| 104 | + LANG="C.UTF-8" \ |
| 105 | + LC_ALL="C.UTF-8" \ |
| 106 | + PYTHONNOUSERSITE=1 |
| 107 | + |
| 108 | +# Installing precomputed python packages |
| 109 | +RUN conda install -y python=3.7.1 \ |
| 110 | + pip=19.1 \ |
| 111 | + mkl=2018.0.3 \ |
| 112 | + mkl-service \ |
| 113 | + numpy=1.15.4 \ |
| 114 | + scipy=1.1.0 \ |
| 115 | + libxml2=2.9.8 \ |
| 116 | + libxslt=1.1.32 \ |
| 117 | + zlib; sync && \ |
| 118 | + chmod -R a+rX /usr/local/miniconda; sync && \ |
| 119 | + chmod +x /usr/local/miniconda/bin/*; sync && \ |
| 120 | + conda build purge-all; sync && \ |
| 121 | + conda clean -tipsy && sync |
| 122 | + |
| 123 | +# Unless otherwise specified each process should only use one thread - nipype |
| 124 | +# will handle parallelization |
| 125 | +ENV MKL_NUM_THREADS=1 \ |
| 126 | + OMP_NUM_THREADS=1 |
| 127 | + |
| 128 | +# Create a shared $HOME directory |
| 129 | +RUN useradd -m -s /bin/bash -G users neuro |
| 130 | +WORKDIR /home/neuro |
| 131 | +ENV HOME="/home/neuro" |
| 132 | + |
| 133 | +# Install package |
| 134 | +COPY . /src/nitransforms |
| 135 | +ARG VERSION |
| 136 | +# Force static versioning within container |
| 137 | +RUN echo "${VERSION}" > /src/nitransforms/nitransforms/VERSION && \ |
| 138 | + echo "include nitransforms/VERSION" >> /src/nitransforms/MANIFEST.in && \ |
| 139 | + pip install --no-cache-dir "/src/nitransforms[all]" |
| 140 | + |
| 141 | +RUN find $HOME -type d -exec chmod go=u {} + && \ |
| 142 | + find $HOME -type f -exec chmod go=u {} + |
| 143 | + |
| 144 | + |
| 145 | +RUN ldconfig |
| 146 | +WORKDIR /tmp/ |
| 147 | + |
| 148 | +ARG BUILD_DATE |
| 149 | +ARG VCS_REF |
| 150 | +ARG VERSION |
| 151 | +LABEL org.label-schema.build-date=$BUILD_DATE \ |
| 152 | + org.label-schema.name="nitransforms" \ |
| 153 | + org.label-schema.vcs-url="https://github.com/poldracklab/nitransforms" \ |
| 154 | + org.label-schema.version=$VERSION \ |
| 155 | + org.label-schema.schema-version="1.0" |
0 commit comments