diff --git a/docker-hooks.sh b/docker-hooks.sh index 29b6dba..b855fff 100644 --- a/docker-hooks.sh +++ b/docker-hooks.sh @@ -35,3 +35,14 @@ function get_tags_in_docker { tags=$(curl $tag_url 2>/dev/null | docker run -i stedolan/jq '."results"[]["name"]') echo $tags } + +function tag_and_push { + local tag=$1 + local major_tag=$2 + + set -e + docker tag $image:latest $image:$tag + docker push $image:$tag + docker tag $image:latest $image:$major_tag + docker push $image:$major_tag +} diff --git a/golang/hooks/post_push b/golang/hooks/post_push new file mode 100755 index 0000000..cf61948 --- /dev/null +++ b/golang/hooks/post_push @@ -0,0 +1,13 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/golang" +tag=$(get_tag go) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + # major tag format x.y, such as 1.12, 1.13 + major_tag=${tag%.*} + tag_and_push $tag $major_tag +fi diff --git a/haproxy/hooks/post_push b/haproxy/hooks/post_push new file mode 100755 index 0000000..d01c320 --- /dev/null +++ b/haproxy/hooks/post_push @@ -0,0 +1,13 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/haproxy" +tag=$(get_tag haproxy) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + # major tag format 1.6 or 2.0 + major_tag=${tag%.*} + tag_and_push $tag $major_tag +fi diff --git a/httpd/hooks/post_push b/httpd/hooks/post_push new file mode 100755 index 0000000..023d2a3 --- /dev/null +++ b/httpd/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/httpd" +tag=$(get_tag httpd) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/iperf/hooks/post_push b/iperf/hooks/post_push new file mode 100755 index 0000000..9f6d250 --- /dev/null +++ b/iperf/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/iperf" +tag=$(get_tag iperf) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/mariadb/hooks/post_push b/mariadb/hooks/post_push new file mode 100755 index 0000000..b1e4eca --- /dev/null +++ b/mariadb/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/mariadb" +tag=$(get_tag mariadb) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/memcached/hooks/post_push b/memcached/hooks/post_push new file mode 100755 index 0000000..716168a --- /dev/null +++ b/memcached/hooks/post_push @@ -0,0 +1,13 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/memcached" +tag=$(get_tag memcached) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + # major tag format like 1.4 or 1.5 + major_tag=${tag%.*} + tag_and_push $tag $major_tag +fi diff --git a/nginx/hooks/post_push b/nginx/hooks/post_push new file mode 100755 index 0000000..af8818e --- /dev/null +++ b/nginx/hooks/post_push @@ -0,0 +1,13 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/nginx" +tag=$(get_tag nginx-mainline) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + # major tag format 1.16 or 1.17 + major_tag=${tag%.*} + tag_and_push $tag $major_tag +fi diff --git a/node/hooks/post_push b/node/hooks/post_push new file mode 100755 index 0000000..c985a16 --- /dev/null +++ b/node/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/node" +tag=$(get_tag nodejs) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/openjdk/hooks/post_push b/openjdk/hooks/post_push new file mode 100755 index 0000000..2eed6a2 --- /dev/null +++ b/openjdk/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/openjdk" +tag=$(get_tag openjdk13) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/openvino/hooks/post_push b/openvino/hooks/post_push new file mode 100755 index 0000000..f4c249d --- /dev/null +++ b/openvino/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/openvino" +tag=$(get_tag dldt) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/perl/hooks/post_push b/perl/hooks/post_push new file mode 100755 index 0000000..dbf8b55 --- /dev/null +++ b/perl/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/perl" +tag=$(get_tag perl) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/php-fpm/hooks/post_push b/php-fpm/hooks/post_push new file mode 100755 index 0000000..d68d37b --- /dev/null +++ b/php-fpm/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/php-fpm" +tag=$(get_tag php) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/php/hooks/post_push b/php/hooks/post_push new file mode 100755 index 0000000..cda798d --- /dev/null +++ b/php/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/php" +tag=$(get_tag php) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/postgres/hooks/post_push b/postgres/hooks/post_push new file mode 100755 index 0000000..f140afa --- /dev/null +++ b/postgres/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/postgres" +tag=$(get_tag postgresql11) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/python/hooks/post_push b/python/hooks/post_push new file mode 100755 index 0000000..e70ff34 --- /dev/null +++ b/python/hooks/post_push @@ -0,0 +1,13 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/python" +tag=$(get_tag python3) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + # major tag format x.y, such as 3.6 , 3.7 + major_tag=${tag%.*} + tag_and_push $tag $major_tag +fi diff --git a/rabbitmq/hooks/post_push b/rabbitmq/hooks/post_push new file mode 100755 index 0000000..6a44c25 --- /dev/null +++ b/rabbitmq/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/rabbitmq" +tag=$(get_tag rabbitmq-server) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/redis/hooks/post_push b/redis/hooks/post_push index f7a8e33..394a933 100755 --- a/redis/hooks/post_push +++ b/redis/hooks/post_push @@ -7,10 +7,6 @@ image="clearlinux/redis" tag=$(get_tag redis-native) if [ $? -eq 0 ] && [ -n "$tag" ]; then - set -e - docker tag $image:latest $image:$tag - docker push $image:$tag major_tag=${tag%%.*} - docker tag $image:latest $image:$major_tag - docker push $image:$major_tag + tag_and_push $tag $major_tag fi diff --git a/ruby/hooks/post_push b/ruby/hooks/post_push new file mode 100755 index 0000000..e02c459 --- /dev/null +++ b/ruby/hooks/post_push @@ -0,0 +1,12 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/ruby" +tag=$(get_tag ruby) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + major_tag=${tag%%.*} + tag_and_push $tag $major_tag +fi diff --git a/tensorflow-serving/hooks/post_push b/tensorflow-serving/hooks/post_push new file mode 100755 index 0000000..9870c78 --- /dev/null +++ b/tensorflow-serving/hooks/post_push @@ -0,0 +1,13 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/tensorflow-serving" +tag=$(get_tag tensorflow-serving) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + # major tag format x.y, such as 1.14 + major_tag=${tag%.*} + tag_and_push $tag $major_tag +fi diff --git a/tensorflow/hooks/post_push b/tensorflow/hooks/post_push new file mode 100755 index 0000000..529ada6 --- /dev/null +++ b/tensorflow/hooks/post_push @@ -0,0 +1,13 @@ +#!/bin/bash +echo "=> Tagging the image" + +. ../docker-hooks.sh + +image="clearlinux/tensorflow" +tag=$(get_tag tensorflow) + +if [ $? -eq 0 ] && [ -n "$tag" ]; then + # major tag format x.y, such as 1.16 + major_tag=${tag%.*} + tag_and_push $tag $major_tag +fi