Semaphore/deployment/docker/ci/bin/build.sh

30 lines
792 B
Bash
Raw Normal View History

2022-03-09 01:23:56 +01:00
#!/bin/bash -l
# Set env
2022-03-09 20:03:21 +01:00
SUSER=$USER
2022-03-09 01:23:56 +01:00
SCRIPT_HOME=$(realpath $(dirname $0))
SEMAPHORE_HOME=$(realpath $SCRIPT_HOME/../../../../)
echo "Building in $SEMAPHORE_HOME"
2022-03-09 01:23:56 +01:00
2022-03-09 20:03:21 +01:00
if [[ ! -f $SCRIPT_HOME/../semaphore.simg ]]; then
# Build Image
sudo bash -lc "
# Set env
module purge
module load singularity || echo 'Not using modules'
export SINGULARITY_BIND=${SEMAPHORE_HOME}:/mnt
# Build image
2022-03-09 20:03:21 +01:00
cd $SCRIPT_HOME/../ && singularity build semaphore.simg Singularity
2022-03-09 01:23:56 +01:00
2022-03-09 20:03:21 +01:00
# Update perms
chmod -R ${SUSER}: $SEMAPHORE_HOME"
else
# Build RPM
2022-03-09 20:03:21 +01:00
module load singularity || echo 'Not using modules'
2022-03-09 20:59:10 +01:00
cd ${SEMAPHORE_HOME} && singularity exec $SCRIPT_HOME/../semaphore.simg task release
chmod a+rx ${SEMAPHORE_HOME}/bin
chmod a+r ${SEMAPHORE_HOME}/bin/*
2022-03-09 20:03:21 +01:00
fi
2022-03-09 01:23:56 +01:00