#!/bin/sh set -e set -u # DEBUG #set -x common_start() { figlet "${target}" deployment="${1:-${deployment:-}}" action="${action:-deploy}" # detach on production deployment if [ "${deployment}" = 'prod' ]; then detach='-d' fi # ensure uses main branch branch and that it is up to date ( cd ./IdHub if [ -d .git ]; then git checkout main git pull fi ) # some targets might use idhub1 and/or idhub2 idhub1="${idhub1:-idhub1__${target}}" idhub2="${idhub2:-idhub2__${target}}" } common_end() { dc_file="docker-compose__${target}.yml" docker compose -p ${target} -f ${dc_file} down -v || true make idhub_build if [ "${action:-}" = "deploy" ]; then docker compose -p ${target} -f ${dc_file} up ${detach:-} wait_seconds="${wait_seconds:-20}" echo "Give ${wait_seconds} seconds to this new deployment to be setted up" sleep "${wait_seconds}" fi }