-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_singularity_el7
executable file
·25 lines (18 loc) · 859 Bytes
/
build_singularity_el7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
U=$(id -nu)
G=$(id -ng)
VER="7"
NAME="el${VER}cvmfs.sif"
SING_CONF="el${VER}cvmfs.sing"
if [[ "${1}" == "sandbox" ]]; then
shift
DO_SANDBOX="--sandbox --fix-perms"
NAME="${NAME}_sandbox"
fi
[[ -e "${NAME}" ]] && rm -f "${NAME}"
singularity remote login -u asevcenc -p "$(< ~/gitlab_cern.token)" docker://gitlab-registry.cern.ch && \
singularity build --fakeroot ${DO_SANDBOX} "${NAME}" "${SING_CONF}" || { echo "Build failed!"; exit 1; }
[[ -n "${DO_SANDBOX}" ]] && sudo chown -R ${U}:${G} "${NAME}"
sudo chown -R ${U}:${G} "${SINGULARITY_CACHEDIR:-${HOME}/.singularity/cache}"
oras login -u robot-asevcenc+asevcenc_push -p $(< ~/registry-cern-robot.token) registry.cern.ch
oras push registry.cern.ch/asevcenc/$(basename ${NAME} .sif):latest ${NAME}:application/vnd.sylabs.sif.layer.v1.sif && echo "Done" || echo "Fail"