Add post_build hook to tag latest
authorThomas Bruederli <redacted>
Wed, 24 Jul 2019 19:41:55 +0000 (21:41 +0200)
committerThomas Bruederli <redacted>
Wed, 24 Jul 2019 19:41:55 +0000 (21:41 +0200)
hooks/post_build [new file with mode: 0755]

diff --git a/hooks/post_build b/hooks/post_build
new file mode 100755 (executable)
index 0000000..23a078e
--- /dev/null
@@ -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
git clone https://git.99rst.org/PROJECT