buba/scripts/pull-and-restart.sh
Stefan Bethke 82d4f40a08
All checks were successful
docker-image / docker (push) Successful in 10m11s
Helper to auto deploy from cron
2025-06-02 20:10:33 +02:00

17 lines
451 B
Bash
Executable file

#!/bin/sh
#
# Try to pull the most recent image, and restart docker compose if it has changes
#
if [ $# -ne 2 ]; then
echo "usage: pull-and-restart image compose.yaml" >&2
exit 64
fi
before="$(docker inspect --format='{{index .RepoDigests 0}}' $1)"
docker pull docker inspect --format='{{index .RepoDigests 0}}'
after="$(docker inspect --format='{{index .RepoDigests 0}}' $1)"
if [ "$before" != "$after" ]; then
docker compose -f $2 up -d
fi