termux-packages/scripts/update-docker.sh

20 lines
494 B
Bash
Raw Normal View History

#!/bin/sh
set -e -u
CONTAINER=termux-package-builder
IMAGE=termux/package-builder
docker pull $IMAGE
2019-02-12 09:41:30 +01:00
LATEST=$(docker inspect --format "{{.Id}}" $IMAGE)
RUNNING=$(docker inspect --format "{{.Image}}" $CONTAINER)
if [ $LATEST = $RUNNING ]; then
echo "Image '$IMAGE' used in the container '$CONTAINER' is already up to date"
else
echo "Image '$IMAGE' used in the container '$CONTAINER' has been updated - removing the outdated container"
docker stop $CONTAINER
docker rm -f $CONTAINER
fi