From accbe1af59bed7ddcd1d4656bb4843bd3de1a82e Mon Sep 17 00:00:00 2001 From: Aaron Birkland Date: Wed, 29 Sep 2021 17:53:34 -0400 Subject: [PATCH] Add script to tag and push images --- tag_and_push_images.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 tag_and_push_images.sh diff --git a/tag_and_push_images.sh b/tag_and_push_images.sh new file mode 100755 index 000000000..d91f92058 --- /dev/null +++ b/tag_and_push_images.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +GIT_TAG=$(git describe --tags --always) + +for image_uri in $(cat docker-compose.yml | grep ghcr | awk '{print $2}'); do + image_name=$(echo ${image_uri} | tr ':' ' ' | awk '{print $1}' | awk -F "/" '{print $NF}') + echo $image_name + + dest_url=${DOCKER_PUSH_REPOSITORY}/${image_name}:${GIT_TAG} + + docker tag $image_uri $dest_url + docker push $dest_url +done