From 742d4eb3de00398ca0435775d2df9f6f070f4eed Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Wed, 24 Jul 2019 21:41:55 +0200 Subject: [PATCH] Add post_build hook to tag latest --- hooks/post_build | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 hooks/post_build diff --git a/hooks/post_build b/hooks/post_build new file mode 100755 index 0000000..23a078e --- /dev/null +++ b/hooks/post_build @@ -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