services-garbaye/podman-peerjs/50_update.sh
2022-03-05 10:26:09 +01:00

34 lines
837 B
Bash
Executable file

#!/usr/bin/env bash
ABSDIR="$( dirname "$(realpath -s -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
ensure_container_exists ${container_name}
upstream_imageversion=${upstream_images}:${version}
current_imageversion=$(podman container inspect -f '{{.ImageName}}' ${container_name})
if [[ "${upstream_imageversion}" == "${current_imageversion}" ]] ; then
echo Container ${container_name} does not need rebuilding. Exiting.
exit 0
fi
echo Rebuilding container ${container_name} with image ${upstream_imageversion}
# build first for minimal downtime
source ${ABSDIR}/zz_build-images.sh
${ABSDIR}/40_stop.sh
${ABSDIR}/80_destroy.sh
${ABSDIR}/10_install.sh
${ABSDIR}/20_enable.sh
${ABSDIR}/30_start.sh
podman rmi ${current_imageversion}
${ABSDIR}/00_status.sh