|
| 1 | +# fMRIPrep Docker Container Image distribution |
| 2 | +# |
| 3 | +# MIT License |
| 4 | +# |
| 5 | +# Copyright (c) The NiPreps Developers |
| 6 | +# |
| 7 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | +# of this software and associated documentation files (the "Software"), to deal |
| 9 | +# in the Software without restriction, including without limitation the rights |
| 10 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | +# copies of the Software, and to permit persons to whom the Software is |
| 12 | +# furnished to do so, subject to the following conditions: |
| 13 | +# |
| 14 | +# The above copyright notice and this permission notice shall be included in all |
| 15 | +# copies or substantial portions of the Software. |
| 16 | +# |
| 17 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | +# SOFTWARE. |
| 24 | + |
| 25 | +# Ubuntu 22.04 LTS - Jammy |
| 26 | +ARG BASE_IMAGE=ubuntu:jammy-20250730 |
| 27 | + |
| 28 | +# |
| 29 | +# Download stages |
| 30 | +# |
| 31 | + |
| 32 | +# Utilities for downloading packages |
| 33 | +FROM ${BASE_IMAGE} AS downloader |
| 34 | +ENV DEBIAN_FRONTEND="noninteractive" \ |
| 35 | + LANG="en_US.UTF-8" \ |
| 36 | + LC_ALL="en_US.UTF-8" |
| 37 | + |
| 38 | +# Bump the date to current to refresh curl/certificates/etc |
| 39 | +RUN echo "2025.08.20" |
| 40 | +RUN apt-get update && \ |
| 41 | + apt-get install -y --no-install-recommends \ |
| 42 | + binutils \ |
| 43 | + bzip2 \ |
| 44 | + ca-certificates \ |
| 45 | + curl \ |
| 46 | + unzip && \ |
| 47 | + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 48 | + |
| 49 | +# FreeSurfer 7.3.2 |
| 50 | +FROM downloader AS freesurfer |
| 51 | +COPY docker/files/freesurfer7.3.2-exclude.txt /usr/local/etc/freesurfer7.3.2-exclude.txt |
| 52 | +RUN curl -sSL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.3.2/freesurfer-linux-ubuntu22_amd64-7.3.2.tar.gz \ |
| 53 | + | tar zxv --no-same-owner -C /opt --exclude-from=/usr/local/etc/freesurfer7.3.2-exclude.txt |
| 54 | + |
| 55 | +# MSM HOCR (Nov 19, 2019 release) |
| 56 | +FROM downloader AS msm |
| 57 | +RUN curl -L -H "Accept: application/octet-stream" https://api.github.com/repos/ecr05/MSM_HOCR/releases/assets/16253707 -o /usr/local/bin/msm \ |
| 58 | + && chmod +x /usr/local/bin/msm |
| 59 | + |
| 60 | +# |
| 61 | +# Main stage |
| 62 | +# |
| 63 | +FROM ${BASE_IMAGE} AS base |
| 64 | + |
| 65 | +# Configure apt |
| 66 | +ENV DEBIAN_FRONTEND="noninteractive" \ |
| 67 | + LANG="en_US.UTF-8" \ |
| 68 | + LC_ALL="en_US.UTF-8" |
| 69 | + |
| 70 | +# Install downloaded files from stages |
| 71 | +COPY --link --from=freesurfer /opt/freesurfer /opt/freesurfer |
| 72 | +COPY --link --from=msm /usr/local/bin/msm /usr/local/bin/msm |
| 73 | + |
| 74 | +# Some baseline tools; bc is needed for FreeSurfer, so don't drop it |
| 75 | +RUN apt-get update && \ |
| 76 | + apt-get install -y --no-install-recommends \ |
| 77 | + bc \ |
| 78 | + ca-certificates \ |
| 79 | + curl \ |
| 80 | + libgomp1 \ |
| 81 | + libopenblas0-openmp \ |
| 82 | + lsb-release \ |
| 83 | + netbase \ |
| 84 | + tcsh \ |
| 85 | + xvfb && \ |
| 86 | + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 87 | + |
| 88 | + |
| 89 | +# Install AFNI from Docker container |
| 90 | +# Find libraries with `ldd $BINARIES | grep afni` |
| 91 | +COPY --link --from=afni/afni_make_build:AFNI_25.2.09 \ |
| 92 | + /opt/afni/install/libf2c.so \ |
| 93 | + /opt/afni/install/libmri.so \ |
| 94 | + /usr/local/lib/ |
| 95 | +COPY --link --from=afni/afni_make_build:AFNI_25.2.09 \ |
| 96 | + /opt/afni/install/3dAutomask \ |
| 97 | + /opt/afni/install/3dTshift \ |
| 98 | + /opt/afni/install/3dUnifize \ |
| 99 | + /opt/afni/install/3dvolreg \ |
| 100 | + /usr/local/bin/ |
| 101 | + |
| 102 | +# Changing library paths requires a re-ldconfig |
| 103 | +RUN ldconfig |
| 104 | + |
| 105 | +# Simulate SetUpFreeSurfer.sh |
| 106 | +ENV OS="Linux" \ |
| 107 | + FS_OVERRIDE=0 \ |
| 108 | + FIX_VERTEX_AREA="" \ |
| 109 | + FSF_OUTPUT_FORMAT="nii.gz" \ |
| 110 | + FREESURFER_HOME="/opt/freesurfer" |
| 111 | +ENV SUBJECTS_DIR="$FREESURFER_HOME/subjects" \ |
| 112 | + FUNCTIONALS_DIR="$FREESURFER_HOME/sessions" \ |
| 113 | + MNI_DIR="$FREESURFER_HOME/mni" \ |
| 114 | + LOCAL_DIR="$FREESURFER_HOME/local" \ |
| 115 | + MINC_BIN_DIR="$FREESURFER_HOME/mni/bin" \ |
| 116 | + MINC_LIB_DIR="$FREESURFER_HOME/mni/lib" \ |
| 117 | + MNI_DATAPATH="$FREESURFER_HOME/mni/data" |
| 118 | +ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \ |
| 119 | + MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \ |
| 120 | + PATH="$FREESURFER_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH" |
| 121 | + |
| 122 | +# AFNI config |
| 123 | +ENV AFNI_IMSAVE_WARNINGS="NO" |
| 124 | + |
| 125 | +# FSL environment |
| 126 | +ENV LANG="C.UTF-8" \ |
| 127 | + LC_ALL="C.UTF-8" \ |
| 128 | + PYTHONNOUSERSITE=1 \ |
| 129 | + FSLOUTPUTTYPE="NIFTI_GZ" \ |
| 130 | + FSLMULTIFILEQUIT="TRUE" \ |
| 131 | + FSLLOCKDIR="" \ |
| 132 | + FSLMACHINELIST="" \ |
| 133 | + FSLREMOTECALL="" \ |
| 134 | + FSLGECUDAQ="cuda.q" |
0 commit comments