-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from pni-lab/slurmify-pumi
Fix critical bugs and integrate new features
- Loading branch information
Showing
13 changed files
with
735 additions
and
890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,280 @@ | ||
# This Dockerfile is written with the help of the output of Neurodocker | ||
|
||
# Dockerfile_v0.7 introduces the following changes: | ||
# 1. Use Python 3.11 instead of Python 3.8 | ||
# - Deepbet is now going to work | ||
# 2. Update FSL from version 6.0.1 to 6.0.5 | ||
# - Also fixes crashing FSL installation process | ||
# 3. Rework installation of PUMI's required packages | ||
# - Fix conda package installation problems | ||
# - Install needed software like gcc | ||
# - Be more specific about package versions | ||
# - Try newer version of scikit-learn (1.3.2), because current version won't work with Python versions >= 3.12 | ||
# ------------------------------------------------- | ||
|
||
FROM debian:buster-slim | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
LABEL maintainer="Tamas Spisak <[email protected]>" | ||
|
||
ARG NB_USER="pumi" | ||
ARG NB_UID="1000" | ||
ARG NB_GID="100" | ||
|
||
USER root | ||
|
||
# [ROOT] SET UP CONDA: | ||
|
||
ENV CONDA_DIR="/opt/miniconda-latest" \ | ||
PATH="/opt/miniconda-latest/bin:$PATH" | ||
|
||
RUN apt-get update --yes && apt-get upgrade --yes && apt-get install --yes --no-install-recommends \ | ||
git \ | ||
bzip2 \ | ||
ca-certificates \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& export PATH="/opt/miniconda-latest/bin:$PATH" \ | ||
&& echo "Downloading Miniconda installer ..." \ | ||
&& conda_installer="/tmp/miniconda.sh" \ | ||
&& curl -fsSL -o "$conda_installer" https://repo.anaconda.com/miniconda/Miniconda3-py38_22.11.1-1-Linux-x86_64.sh \ | ||
&& bash "$conda_installer" -b -p /opt/miniconda-latest \ | ||
&& rm -f "$conda_installer" \ | ||
&& conda update -yq -nbase conda \ | ||
&& conda config --system --prepend channels conda-forge \ | ||
&& conda config --system --prepend channels mrtrix3 \ | ||
# && conda config --set channel_priority false \ | ||
&& conda config --system --set auto_update_conda false \ | ||
&& conda config --system --set show_channel_urls true \ | ||
# Enable `conda activate` | ||
&& conda init bash \ | ||
&& conda install -y --name base \ | ||
"python=3.11" \ | ||
"libstdcxx-ng" \ | ||
# Clean up | ||
&& sync && conda clean --all --yes && sync \ | ||
&& rm -rf ~/.cache/pip/* | ||
|
||
|
||
# ********************************************************************************************************************** | ||
|
||
# [ROOT] CREATE USER: | ||
# The following part for the user-creation is adapted from Jupyter Docker Stacks | ||
# https://github.com/jupyter/docker-stacks/blob/main/docker-stacks-foundation/Dockerfile | ||
|
||
ENV HOME="/home/${NB_USER}" | ||
|
||
RUN apt-get update --yes && apt-get upgrade --yes && apt-get install --yes --no-install-recommends \ | ||
bzip2 \ | ||
ca-certificates \ | ||
sudo && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN echo "auth requisite pam_deny.so" >> /etc/pam.d/su && \ | ||
sed -i.bak -e 's/^%admin/#%admin/' /etc/sudoers && \ | ||
sed -i.bak -e 's/^%sudo/#%sudo/' /etc/sudoers && \ | ||
useradd -l -m -s /bin/bash -N -u "${NB_UID}" "${NB_USER}" && \ | ||
mkdir -p "${CONDA_DIR}" && \ | ||
chown "${NB_USER}:${NB_GID}" "${CONDA_DIR}" && \ | ||
chmod g+w /etc/passwd | ||
|
||
# fix permissions | ||
RUN chgrp -R "${NB_GID}" "${HOME}" && chmod -R 777 "${HOME}" | ||
RUN chgrp -R "${NB_GID}" "${CONDA_DIR}" && chmod -R g+rwX "${CONDA_DIR}" && find "${CONDA_DIR}" -type d -exec chmod +6000 {} + | ||
|
||
# ********************************************************************************************************************** | ||
|
||
# [ROOT] INSTALL AFNI: | ||
|
||
RUN apt-get update -qq \ | ||
&& apt-get install -y -q --no-install-recommends \ | ||
git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
ENV PATH="/opt/afni-latest:$PATH" \ | ||
AFNI_PLUGINPATH="/opt/afni-latest" | ||
RUN apt-get update -qq \ | ||
&& apt-get install -y -q --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
ed \ | ||
gsl-bin \ | ||
libgl1-mesa-dri \ | ||
libglib2.0-0 \ | ||
libglu1-mesa-dev \ | ||
libglw1-mesa \ | ||
libgomp1 \ | ||
libjpeg62 \ | ||
libxm4 \ | ||
multiarch-support \ | ||
netpbm \ | ||
tcsh \ | ||
xfonts-base \ | ||
xvfb \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& _reproenv_tmppath="$(mktemp -t tmp.XXXXXXXXXX.deb)" \ | ||
&& curl -fsSL --retry 5 -o "${_reproenv_tmppath}" http://launchpadlibrarian.net/160108232/libxp6_1.0.2-1ubuntu1_amd64.deb \ | ||
&& apt-get install --yes -q "${_reproenv_tmppath}" \ | ||
&& rm "${_reproenv_tmppath}" \ | ||
&& _reproenv_tmppath="$(mktemp -t tmp.XXXXXXXXXX.deb)" \ | ||
&& curl -fsSL --retry 5 -o "${_reproenv_tmppath}" http://snapshot.debian.org/archive/debian-security/20160113T213056Z/pool/updates/main/libp/libpng/libpng12-0_1.2.49-1%2Bdeb7u2_amd64.deb \ | ||
&& apt-get install --yes -q "${_reproenv_tmppath}" \ | ||
&& rm "${_reproenv_tmppath}" \ | ||
&& apt-get update -qq \ | ||
&& apt-get install --yes --quiet --fix-missing \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& gsl_path="$(find / -name 'libgsl.so.??' || printf '')" \ | ||
&& if [ -n "$gsl_path" ]; then \ | ||
ln -sfv "$gsl_path" "$(dirname $gsl_path)/libgsl.so.0"; \ | ||
fi \ | ||
&& ldconfig \ | ||
&& mkdir -p /opt/afni-latest \ | ||
&& echo "Downloading AFNI ..." \ | ||
&& curl -fL https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \ | ||
| tar -xz -C /opt/afni-latest --strip-components 1 | ||
|
||
# ********************************************************************************************************************** | ||
|
||
# [ROOT] INSTALL ANTS: | ||
|
||
ENV ANTSPATH="/opt/ants-2.3.4/" \ | ||
PATH="/opt/ants-2.3.4:$PATH" | ||
RUN apt-get update -qq \ | ||
&& apt-get install -y -q --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& echo "Downloading ANTs ..." \ | ||
&& mkdir -p /opt/ants-2.3.4 \ | ||
&& curl -fsSL https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz \ | ||
| tar -xz -C /opt/ants-2.3.4 --strip-components 1 | ||
|
||
# ********************************************************************************************************************** | ||
|
||
# [ROOT] INSTALL Convert3D: | ||
|
||
ENV C3DPATH="/opt/convert3d-1.0.0" \ | ||
PATH="/opt/convert3d-1.0.0/bin:$PATH" | ||
|
||
RUN apt-get update -qq \ | ||
&& apt-get install -y -q --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& echo "Downloading Convert3D ..." \ | ||
&& mkdir -p /opt/convert3d-1.0.0 \ | ||
&& curl -fsSL https://sourceforge.net/projects/c3d/files/c3d/1.0.0/c3d-1.0.0-Linux-x86_64.tar.gz/download \ | ||
| tar -xz -C /opt/convert3d-1.0.0 --strip-components 1 | ||
|
||
# ********************************************************************************************************************** | ||
|
||
# [ROOT] INSTALL FSL: | ||
|
||
ENV FSLDIR="/opt/fsl-6.0.5" \ | ||
PATH="/opt/fsl-6.0.5/bin:$PATH" \ | ||
FSLOUTPUTTYPE="NIFTI_GZ" \ | ||
FSLMULTIFILEQUIT="TRUE" \ | ||
FSLTCLSH="/opt/fsl-6.0.5/bin/fsltclsh" \ | ||
FSLWISH="/opt/fsl-6.0.5/bin/fslwish" \ | ||
FSLLOCKDIR="" \ | ||
FSLMACHINELIST="" \ | ||
FSLREMOTECALL="" \ | ||
FSLGECUDAQ="cuda.q" | ||
RUN apt-get update -qq \ | ||
&& apt-get install -y -q --no-install-recommends \ | ||
bc \ | ||
ca-certificates \ | ||
curl \ | ||
dc \ | ||
file \ | ||
libfontconfig1 \ | ||
libfreetype6 \ | ||
libgl1-mesa-dev \ | ||
libgl1-mesa-dri \ | ||
libglu1-mesa-dev \ | ||
libgomp1 \ | ||
libice6 \ | ||
libopenblas-base \ | ||
libxcursor1 \ | ||
libxft2 \ | ||
libxinerama1 \ | ||
libxrandr2 \ | ||
libxrender1 \ | ||
libxt6 \ | ||
nano \ | ||
sudo \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& echo "Downloading FSL ..." \ | ||
&& mkdir -p /opt/fsl-6.0.5 \ | ||
&& curl -fL https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.5-centos7_64.tar.gz \ | ||
| tar -xz -C /opt/fsl-6.0.5 --strip-components 1 \ | ||
&& echo "Installing FSL conda environment ..." \ | ||
&& bash /opt/fsl-6.0.5/etc/fslconf/fslpython_install.sh -f /opt/fsl-6.0.5 | ||
|
||
# ********************************************************************************************************************** | ||
|
||
RUN apt-get update --yes && apt-get upgrade --yes && apt-get install --yes --no-install-recommends \ | ||
graphviz \ | ||
build-essential && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
USER ${NB_UID} | ||
|
||
# [USER] INSTALL REQUIRED PUMI PACKAGES: | ||
|
||
RUN conda install -y --name base \ | ||
"mrtrix3" \ | ||
"traits" \ | ||
"numpydoc" \ | ||
"nbsphinx" \ | ||
"pybids" \ | ||
"poetry" \ | ||
"poetry-dynamic-versioning" \ | ||
"dot2tex" \ | ||
"click" | ||
|
||
RUN pip install --no-cache-dir \ | ||
"networkx<3" \ | ||
"dot2tex>=2.11.3" \ | ||
"templateflow>=0.8.0" \ | ||
"graphviz>=0.17" \ | ||
"matplotlib>=3.5.2" \ | ||
"numpy>=1.21.1" \ | ||
"scipy>=1.7.1" \ | ||
"numpydoc>=1.1.0" \ | ||
"nbsphinx>=0.8.6" \ | ||
"pytest>=7.1.2" \ | ||
"nipype>=1.8.1" \ | ||
"neurodocker>=0.8.0" \ | ||
"nilearn>=0.9.1" \ | ||
"pybids>=0.15.1" \ | ||
"poetry>=1.1.13" \ | ||
"poetry-dynamic-versioning>=0.17.1" \ | ||
"pydeface>=2.0.0" \ | ||
"seaborn>=0.11.2" \ | ||
"myst-parser" \ | ||
"nibabel>=5.0.0" \ | ||
"git+https://github.com/MIC-DKFZ/HD-BET.git" \ | ||
"deepbet" \ | ||
"scikit-learn==1.3.2" | ||
|
||
|
||
# ********************************************************************************************************************** | ||
|
||
# [USER] SET WORKDIR & CREATE PUMI OUTPUT DIRECTORY: | ||
|
||
WORKDIR "${HOME}" | ||
|
||
RUN mkdir -p "${HOME}"/PUMI/data_out | ||
|
||
# ********************************************************************************************************************** | ||
|
||
USER root | ||
|
||
# [ROOT] FIX PERMISSIONS: | ||
|
||
RUN chgrp -R "${NB_GID}" "${HOME}" && chmod -R 777 "${HOME}" | ||
|
||
# ********************************************************************************************************************** | ||
|
||
USER ${NB_UID} |
Oops, something went wrong.