20 lines
391 B
Bash
20 lines
391 B
Bash
#! /bin/sh
|
|
|
|
img=registry-app.inhome.blapointe.com:5001/bel/dind
|
|
t=latest
|
|
|
|
set -e
|
|
|
|
get_sha() {
|
|
docker inspect $img:$t | grep '"Id"' | awk '{print $NF}' | sed 's/^"sha256://' | sed 's/",$//'
|
|
}
|
|
|
|
was=$(get_sha)
|
|
docker build -f ./Dockerfile -t $img:$t .
|
|
docker push $img:$t
|
|
now=$(get_sha)
|
|
if [ -n "$was" ] && [ "$was" != "$now" ]; then
|
|
echo pruning old $was
|
|
docker rmi "$was" || true
|
|
fi
|