Helper to auto deploy from cron

This commit is contained in:
Stefan Bethke 2025-06-02 20:10:33 +02:00
commit 132e20b220

17
scripts/pull-and-restart.sh Executable file
View file

@ -0,0 +1,17 @@
#!/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