This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
idhub-docker/build__common.sh

48 lines
1.0 KiB
Bash

#!/bin/sh
set -e
set -u
# DEBUG
#set -x
common_start() {
figlet "${pilot}"
deployment="${1:-${deployment:-}}"
action="${action:-deploy}"
# detach on production deployment
if [ "${deployment}" = 'prod' ]; then
detach='-d'
fi
# ensure uses pilot-pangea branch and it is up to date
(
cd ./IdHub
if [ -d .git ]; then
#git checkout ${pilot}
git checkout main
git pull
fi
)
# some pilots might use idhub1 and/or idhub2
idhub1="idhub1__${pilot}"
idhub2="idhub2__${pilot}"
# force recreate
rm -rf "./${idhub1}" "./${idhub2}"
}
common_end() {
dc_file="docker-compose__${pilot}.yml"
docker compose -p ${pilot} -f ${dc_file} down -v || true
make idhub_build
if [ "${action:-}" = "deploy" ]; then
docker compose -p ${pilot} -f ${dc_file} up ${detach:-}
fi
}