Skip to content

Commit

Permalink
Added path to build itksnap using TinyRange.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vbitz authored and stebo85 committed Feb 2, 2024
1 parent da783ed commit 6e8ee65
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 18 deletions.
67 changes: 49 additions & 18 deletions recipes/itksnap/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,55 @@ fi

source ../main_setup.sh

neurodocker generate ${neurodocker_buildMode} \
--base-image ubuntu:22.04 \
--pkg-manager apt \
--run="printf '#!/bin/bash\nls -la' > /usr/bin/ll" \
--run="chmod +x /usr/bin/ll" \
--run="mkdir -p ${mountPointList}" \
--install curl ca-certificates unzip mlocate binutils libqt5gui5 libopengl0 \
--run="curl -fsSL -o /example_data.zip https://www.nitrc.org/frs/download.php/750/MRI-crop.zip \
&& unzip /example_data.zip \
&& rm /example_data.zip" \
--workdir /opt/${toolName}-${toolVersion} \
--env QT_QPA_PLATFORM="xcb" \
--run="curl -fsSL --retry 5 https://ixpeering.dl.sourceforge.net/project/itk-snap/itk-snap/${toolVersion}/itksnap-${toolVersion}-Linux-gcc64.tar.gz | tar -xz --strip-components=1 -C /opt/${toolName}-${toolVersion}" \
--env DEPLOY_PATH=/opt/${toolName}-${toolVersion}/bin/ \
--env PATH='$PATH':/opt/${toolName}-${toolVersion}/bin/ \
--run="find /opt/itksnap-4.0.2/ -name '*.so.*' | xargs strip --remove-section=.note.ABI-tag" \
--copy README.md /README.md \
> ${imageName}.${neurodocker_buildExt}
if [ -z "$TINYRANGE" ]; then
neurodocker generate ${neurodocker_buildMode} \
--base-image ubuntu:22.04 \
--pkg-manager apt \
--run="printf '#!/bin/bash\nls -la' > /usr/bin/ll" \
--run="chmod +x /usr/bin/ll" \
--run="mkdir -p ${mountPointList}" \
--install curl ca-certificates unzip mlocate binutils libqt5gui5 libopengl0 \
--run="curl -fsSL -o /example_data.zip https://www.nitrc.org/frs/download.php/750/MRI-crop.zip \
&& unzip /example_data.zip \
&& rm /example_data.zip" \
--workdir /opt/${toolName}-${toolVersion} \
--env QT_QPA_PLATFORM="xcb" \
--run="curl -fsSL --retry 5 https://ixpeering.dl.sourceforge.net/project/itk-snap/itk-snap/${toolVersion}/itksnap-${toolVersion}-Linux-gcc64.tar.gz | tar -xz --strip-components=1 -C /opt/${toolName}-${toolVersion}" \
--env DEPLOY_PATH=/opt/${toolName}-${toolVersion}/bin/ \
--env PATH='$PATH':/opt/${toolName}-${toolVersion}/bin/ \
--run="find /opt/itksnap-4.0.2/ -name '*.so.*' | xargs strip --remove-section=.note.ABI-tag" \
--copy README.md /README.md \
> ${imageName}.${neurodocker_buildExt}
else
echo "EXPERIMENTAL: using tinyrange"

$TINYRANGE login \
--size xl \
--pkg ubuntu:22.04 \
--pkg pkg:unzip,mlocate,binutils,libqt5gui5,libopengl0 \
--file https://www.nitrc.org/frs/download.php/750/MRI-crop.zip \
--file https://ixpeering.dl.sourceforge.net/project/itk-snap/itk-snap/${toolVersion}/itksnap-${toolVersion}-Linux-gcc64.tar.gz \
--exec "set -ex; \
(cd /; unzip /root/MRI-crop.zip); \
rm /root/MRI-crop.zip; \
mkdir -p /opt/${toolName}-${toolVersion}; \
tar -xz --strip-components=1 -C /opt/${toolName}-${toolVersion} -f /root/itksnap-${toolVersion}-Linux-gcc64.tar.gz; \
find /opt/${toolName}-${toolVersion}/ -name '*.so.*' | xargs strip --remove-section=.note.ABI-tag" \
--pull-snapshot itksnap.tar.gz

neurodocker generate ${neurodocker_buildMode} \
--base-image ubuntu:22.04 \
--pkg-manager apt \
--run="printf '#!/bin/bash\nls -la' > /usr/bin/ll" \
--run="chmod +x /usr/bin/ll" \
--run="mkdir -p ${mountPointList}" \
--add ./itksnap.tar.gz / \
--env QT_QPA_PLATFORM="xcb" \
--env DEPLOY_PATH=/opt/${toolName}-${toolVersion}/bin/ \
--env PATH='$PATH':/opt/${toolName}-${toolVersion}/bin/ \
--copy README.md /README.md \
> ${imageName}.${neurodocker_buildExt}
fi

#

Expand Down
4 changes: 4 additions & 0 deletions recipes/main_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export buildDate=`date +%Y%m%d`

export imageName=${toolName}_${toolVersion}

# If TinyRange exists in the expected location then enable it.
if test -f /storage/tinyrange/tinyrange; then
export TINYRANGE=/storage/tinyrange/tinyrange
fi

echo "building $imageName in mode $buildMode"

Expand Down

0 comments on commit 6e8ee65

Please sign in to comment.