Add post_build hook to tag latest

This commit is contained in:
Thomas Bruederli 2019-07-24 21:41:55 +02:00
parent 0a92050b9c
commit 742d4eb3de

14
hooks/post_build Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
tagStart=$(echo $IMAGE_NAME | awk '{print index($1,":")}')
repoName=${IMAGE_NAME:0:tagStart-1}
tagName=${IMAGE_NAME:tagStart:99}
if [ "$tagName" = "latest-apache" ]; then
echo "Tagging $IMAGE_NAME as :latest"
docker tag $IMAGE_NAME ${repoName}:latest
docker push ${repoName}:latest
fi