Skip to content

Commit

Permalink
Merge pull request #2929 from MRtrix3/container_eddyqc_fix
Browse files Browse the repository at this point in the history
Fixes to containers FSL dependency
  • Loading branch information
jdtournier authored Nov 26, 2024
2 parents c9bdac0 + 05d7f1a commit 4fbef98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
32 changes: 18 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG MAKE_JOBS="1"
ARG DEBIAN_FRONTEND="noninteractive"

FROM python:3.8-slim AS base
FROM buildpack-deps:buster AS base-builder
FROM buildpack-deps:bookworm AS base-builder

FROM base-builder AS mrtrix3-builder

Expand All @@ -22,39 +22,40 @@ RUN apt-get -qq update \
libqt5opengl5-dev \
libqt5svg5-dev \
libtiff5-dev \
qt5-default \
python3 \
qtbase5-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# Clone, build, and install MRtrix3.
ARG MAKE_JOBS
WORKDIR /opt/mrtrix3
RUN git clone -b $MRTRIX3_GIT_COMMITISH --depth 1 https://github.com/MRtrix3/mrtrix3.git . \
&& ./configure $MRTRIX3_CONFIGURE_FLAGS \
&& NUMBER_OF_PROCESSORS=$MAKE_JOBS ./build $MRTRIX3_BUILD_FLAGS \
&& python3 ./configure $MRTRIX3_CONFIGURE_FLAGS \
&& NUMBER_OF_PROCESSORS=$MAKE_JOBS python3 ./build $MRTRIX3_BUILD_FLAGS \
&& rm -rf tmp

# Download minified ART ACPCdetect (V2.0).
FROM base-builder as acpcdetect-installer
FROM base-builder AS acpcdetect-installer
WORKDIR /opt/art
RUN curl -fsSL https://osf.io/73h5s/download \
| tar xz --strip-components 1

# Download minified ANTs (2.3.4-2).
FROM base-builder as ants-installer
FROM base-builder AS ants-installer
WORKDIR /opt/ants
RUN curl -fsSL https://osf.io/yswa4/download \
| tar xz --strip-components 1

# Download FreeSurfer files.
FROM base-builder as freesurfer-installer
FROM base-builder AS freesurfer-installer
WORKDIR /opt/freesurfer
RUN curl -fsSLO https://raw.githubusercontent.com/freesurfer/freesurfer/v7.1.1/distribution/FreeSurferColorLUT.txt

# Download minified FSL (6.0.4-2)
FROM base-builder as fsl-installer
# Download minified FSL (6.0.7.7)
FROM base-builder AS fsl-installer
WORKDIR /opt/fsl
RUN curl -fsSL https://osf.io/dtep4/download \
RUN curl -fsSL https://osf.io/ph9ex/download \
| tar xz --strip-components 1

# Build final image.
Expand All @@ -66,7 +67,8 @@ RUN apt-get -qq update \
binutils \
dc \
less \
libfftw3-3 \
libfftw3-single3 \
libfftw3-double3 \
libgl1-mesa-glx \
libgomp1 \
liblapack3 \
Expand All @@ -77,7 +79,8 @@ RUN apt-get -qq update \
libqt5svg5 \
libqt5widgets5 \
libquadmath0 \
libtiff5 \
libtiff5-dev \
python3 \
python3-distutils \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -95,12 +98,13 @@ ENV ANTSPATH="/opt/ants/bin" \
FSLMULTIFILEQUIT="TRUE" \
FSLTCLSH="/opt/fsl/bin/fsltclsh" \
FSLWISH="/opt/fsl/bin/fslwish" \
LD_LIBRARY_PATH="/opt/fsl/lib:$LD_LIBRARY_PATH" \
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/bin:$PATH"
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/share/fsl/bin:$PATH"

# Fix "Singularity container cannot load libQt5Core.so.5" on CentOS 7
RUN strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 \
&& ldconfig \
&& apt-get purge -yq binutils

RUN ln -s /usr/bin/python3 /usr/bin/python

CMD ["/bin/bash"]
8 changes: 4 additions & 4 deletions Singularity
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Include: apt
export FSLDIR FSLOUTPUTTYPE FSLMULTIFILEQUIT FSLTCLSH FSLWISH

# All
LD_LIBRARY_PATH="/.singularity.d/libs:/usr/lib:/opt/fsl/lib:$LD_LIBRARY_PATH"
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/bin:$PATH"
LD_LIBRARY_PATH="/.singularity.d/libs:/usr/lib:$LD_LIBRARY_PATH"
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/share/fsl/bin:$PATH"
export LD_LIBRARY_PATH PATH

%post
Expand All @@ -51,8 +51,8 @@ Include: apt
mkdir -p /opt/ants && curl -fsSL https://osf.io/yswa4/download | tar xz -C /opt/ants --strip-components 1
# Download FreeSurfer lookup table file (v7.1.1).
mkdir -p /opt/freesurfer && curl -fsSL -o /opt/freesurfer/FreeSurferColorLUT.txt https://raw.githubusercontent.com/freesurfer/freesurfer/v7.1.1/distribution/FreeSurferColorLUT.txt
# Download minified FSL (6.0.4-2).
mkdir -p /opt/fsl && curl -fsSL https://osf.io/dtep4/download | tar xz -C /opt/fsl --strip-components 1
# Download minified FSL (6.0.7.7).
mkdir -p /opt/fsl && curl -fsSL https://osf.io/ph9ex/download | tar xz -C /opt/fsl --strip-components 1

# Use Python3 for anything requesting Python, since Python2 is not installed
ln -s /usr/bin/python3 /usr/bin/python
Expand Down

0 comments on commit 4fbef98

Please sign in to comment.