Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to containers FSL dependency #2929

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading