Helper to auto deploy from cron
This commit is contained in:
parent
093a303ec2
commit
132e20b220
1 changed files with 17 additions and 0 deletions
17
scripts/pull-and-restart.sh
Executable file
17
scripts/pull-and-restart.sh
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue