#!/usr/bin/env bash
set -e

export toolName='ants'
export toolVersion='2.5.3' # https://github.com/ANTsX/ANTs/releases

if [ "$1" != "" ]; then
    echo "Entering Debug mode"
    export debug=$1
fi

source ../main_setup.sh

# yes | pip uninstall neurodocker
# pip install --no-cache-dir https://github.com/NeuroDesk/neurodocker/tarball/ants-add-scripts --upgrade

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}" \
   --${toolName} method=source version=${toolVersion} make_opts='-j8'\
   --env DEPLOY_PATH=/opt/ants-${toolVersion}/bin:/opt/ants-${toolVersion}/Scripts \
   --copy README.md /README.md \
  > ${imageName}.${neurodocker_buildExt}

if [ "$1" != "" ]; then
   ./../main_build.sh
fi
