Skip to content

Commit

Permalink
Fix path in build_container
Browse files Browse the repository at this point in the history
  • Loading branch information
dhower-qc committed Jul 29, 2024
1 parent 6667077 commit 7141cb0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions bin/build_container
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ ROOT=$(realpath $(dirname $(dirname $BASH_SOURCE[0])))

CONTAINER_TAG=`cat ${ROOT}/bin/.container-tag`

if [ -v GITHUB_ACTIONS ]; then
echo "ACTIONS"
CONTAINER_PATH=${ROOT}/.singularity/image.sif
HOME_PATH=${GITHUB_WORKSPACE}
SINGULARITY_CACHE=--disable-cache
else
CONTAINER_PATH=${ROOT}/.singularity/image-$CONTAINER_TAG.sif
HOME_PATH=${HOME}
SINGULARITY_CACHE=
fi

# uncomment below if you have sudo permission and don't have fakeroot permission
NEED_SUDO=0
cat /etc/subgid | grep "^$(id -u):"
Expand Down Expand Up @@ -54,13 +65,13 @@ echo "Building container..."
if [ ! -d "${ROOT}/.singularity" ]; then
mkdir -p ${ROOT}/.singularity
fi
if [ -e "${ROOT}/.singularity/image.sif" ]; then
rm -f "${ROOT}/.singularity/image.sif"
if [ -e ${CONTAINER_PATH} ]; then
rm -f ${CONTAINER_PATH}
fi

$SUDO singularity build --force \
$FAKEROOT \
${ROOT}/.singularity/image-${CONTAINER_TAG}.sif \
${CONTAINER_PATH} \
${ROOT}/container.def
if [ $? -ne 0 ]; then
echo "Container build failed." 2>&1
Expand Down

0 comments on commit 7141cb0

Please sign in to comment.