From 73063ff233f0650d2fa3864d5dcdc7acaecd5d24 Mon Sep 17 00:00:00 2001 From: Marko Bocevski Date: Sat, 16 Jan 2021 01:35:41 +0100 Subject: [PATCH] Use IMAGE_TAG to set the docker image tag --- .github/workflows/pr_checks.yml | 49 +++++++++++++++++++++++++++----- images/ckan/2.7/Dockerfile | 3 ++ images/ckan/2.7/Dockerfile.focal | 3 ++ images/ckan/2.8/Dockerfile | 3 ++ images/ckan/2.8/Dockerfile.focal | 3 ++ images/ckan/2.9/Dockerfile | 3 ++ images/ckan/2.9/Dockerfile.focal | 3 ++ images/datapusher/Dockerfile | 3 ++ 8 files changed, 63 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 38a00fa..54d94d3 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -22,23 +22,33 @@ jobs: restore-keys: | ${{ runner.os }}-buildx + - name: Get docker tag for Alpine image + id: alpine + run: | + echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.9/Dockerfile)" + - name: Build CKAN 2.9 alpine uses: docker/build-push-action@v2 with: context: ./images/ckan/2.9 file: ./images/ckan/2.9/Dockerfile push: false - tags: keitaro/ckan:2.9 + tags: keitaro/ckan:${{ steps.alpine.outputs.IMAGE_TAG }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache + - name: Get docker tag for Ubuntu image + id: ubuntu + run: | + echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.9/Dockerfile.focal)" + - name: Build CKAN 2.9 ubuntu uses: docker/build-push-action@v2 with: context: ./images/ckan/2.9 file: ./images/ckan/2.9/Dockerfile.focal push: false - tags: keitaro/ckan:2.9-focal + tags: keitaro/ckan:${{ steps.ubuntu.outputs.IMAGE_TAG }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache @@ -58,23 +68,33 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- + - name: Get docker tag for Alpine image + id: alpine + run: | + echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.8/Dockerfile)" + - name: Build CKAN 2.8 alpine uses: docker/build-push-action@v2 with: context: ./images/ckan/2.8 file: ./images/ckan/2.8/Dockerfile push: false - tags: keitaro/ckan:2.8 + tags: keitaro/ckan:${{ steps.alpine.outputs.IMAGE_TAG }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache + - name: Get docker tag for Ubuntu image + id: ubuntu + run: | + echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.8/Dockerfile.focal)" + - name: Build CKAN 2.8 ubuntu uses: docker/build-push-action@v2 with: context: ./images/ckan/2.8 file: ./images/ckan/2.8/Dockerfile.focal push: false - tags: keitaro/ckan:2.8-focal + tags: keitaro/ckan:${{ steps.ubuntu.outputs.IMAGE_TAG }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache @@ -94,23 +114,33 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- + - name: Get docker tag for Alpine image + id: alpine + run: | + echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.7/Dockerfile)" + - name: Build CKAN 2.7 alpine uses: docker/build-push-action@v2 with: context: ./images/ckan/2.7 file: ./images/ckan/2.7/Dockerfile push: false - tags: keitaro/ckan:2.7 + tags: keitaro/ckan:${{ steps.alpine.outputs.IMAGE_TAG }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache + - name: Get docker tag for Ubuntu image + id: ubuntu + run: | + echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/ckan/2.7/Dockerfile.focal)" + - name: Build CKAN 2.7 ubuntu uses: docker/build-push-action@v2 with: context: ./images/ckan/2.7 file: ./images/ckan/2.7/Dockerfile.focal push: false - tags: keitaro/ckan:2.7-focal + tags: keitaro/ckan:${{ steps.ubuntu.outputs.IMAGE_TAG }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache @@ -130,12 +160,17 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- + - name: Get docker tag for datapusher image + id: datapusher + run: | + echo "::set-output name=IMAGE_TAG::$(awk -F '=' '/IMAGE_TAG/{print $2}' ./images/datapusher/Dockerfile)" + - name: Build CKAN datapusher uses: docker/build-push-action@v2 with: context: ./images/datapusher file: ./images/datapusher/Dockerfile push: false - tags: keitaro/ckandatapusher:latest + tags: keitaro/ckandatapusher:${{ steps.datapusher.outputs.IMAGE_TAG }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache diff --git a/images/ckan/2.7/Dockerfile b/images/ckan/2.7/Dockerfile index 190fd4a..3f04b83 100644 --- a/images/ckan/2.7/Dockerfile +++ b/images/ckan/2.7/Dockerfile @@ -3,6 +3,9 @@ ################## FROM alpine:3.13 as ckanbuild +# Used by Github Actions to tag the image with +ENV IMAGE_TAG=2.7.9 + # Set CKAN version to build ENV GIT_URL=https://github.com/ckan/ckan.git ENV GIT_BRANCH=ckan-2.7.9 diff --git a/images/ckan/2.7/Dockerfile.focal b/images/ckan/2.7/Dockerfile.focal index 8b2cb2d..b7c9cc7 100644 --- a/images/ckan/2.7/Dockerfile.focal +++ b/images/ckan/2.7/Dockerfile.focal @@ -3,6 +3,9 @@ ################## FROM ubuntu:focal-20201106 as ckanbuild +# Used by Github Actions to tag the image with +ENV IMAGE_TAG=2.7.9-focal + # Set CKAN version to build ENV GIT_URL=https://github.com/ckan/ckan.git ENV GIT_BRANCH=ckan-2.7.9 diff --git a/images/ckan/2.8/Dockerfile b/images/ckan/2.8/Dockerfile index c9abcbd..7380077 100644 --- a/images/ckan/2.8/Dockerfile +++ b/images/ckan/2.8/Dockerfile @@ -3,6 +3,9 @@ ################## FROM alpine:3.13 as ckanbuild +# Used by Github Actions to tag the image with +ENV IMAGE_TAG=2.8.6 + # Set CKAN version to build ENV GIT_URL=https://github.com/ckan/ckan.git ENV GIT_BRANCH=ckan-2.8.6 diff --git a/images/ckan/2.8/Dockerfile.focal b/images/ckan/2.8/Dockerfile.focal index f34eea5..ffcf422 100644 --- a/images/ckan/2.8/Dockerfile.focal +++ b/images/ckan/2.8/Dockerfile.focal @@ -3,6 +3,9 @@ ################## FROM ubuntu:focal-20201106 as ckanbuild +# Used by Github Actions to tag the image with +ENV IMAGE_TAG=2.8.6-focal + # Set CKAN version to build ENV GIT_URL=https://github.com/ckan/ckan.git ENV GIT_BRANCH=ckan-2.8.6 diff --git a/images/ckan/2.9/Dockerfile b/images/ckan/2.9/Dockerfile index a89d061..acf4b66 100644 --- a/images/ckan/2.9/Dockerfile +++ b/images/ckan/2.9/Dockerfile @@ -3,6 +3,9 @@ ################## FROM alpine:3.13 as ckanbuild +# Used by Github Actions to tag the image with +ENV IMAGE_TAG=2.9.1 + # Set CKAN version to build ENV GIT_URL=https://github.com/ckan/ckan.git ENV GIT_BRANCH=ckan-2.9.1 diff --git a/images/ckan/2.9/Dockerfile.focal b/images/ckan/2.9/Dockerfile.focal index e285623..a0fa8f5 100644 --- a/images/ckan/2.9/Dockerfile.focal +++ b/images/ckan/2.9/Dockerfile.focal @@ -3,6 +3,9 @@ ################## FROM ubuntu:focal-20201106 as ckanbuild +# Used by Github Actions to tag the image with +ENV IMAGE_TAG=2.9.1-focal + # Set CKAN version to build ENV GIT_URL=https://github.com/ckan/ckan.git ENV GIT_BRANCH=ckan-2.9.1 diff --git a/images/datapusher/Dockerfile b/images/datapusher/Dockerfile index 86756cf..3385d40 100644 --- a/images/datapusher/Dockerfile +++ b/images/datapusher/Dockerfile @@ -3,6 +3,9 @@ ############# FROM alpine:3.13 as build +# Used by Github Actions to tag the image with +ENV IMAGE_TAG=0.0.17 + # Set datapusher version to build ENV GIT_URL https://github.com/keitaroinc/datapusher.git ENV GIT_BRANCH master