From 37fd77c46025649cc258493860c5cb667311a0d9 Mon Sep 17 00:00:00 2001 From: Jeremy Cocks <98757756+jeremy-cxf@users.noreply.github.com> Date: Thu, 22 Jun 2023 20:30:23 +0100 Subject: [PATCH] Manual Release for Nginxinc (#57) * move to buildx actions * move to buildx actions * formatting * Refactor and use github actions build * format * Skip push if running in ACT --------- Co-authored-by: Jeremy --- .github/workflows/manual-nginxinc.yml | 43 +++++++++++++++++++++------ 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/manual-nginxinc.yml b/.github/workflows/manual-nginxinc.yml index 71bfce8..6ea705e 100644 --- a/.github/workflows/manual-nginxinc.yml +++ b/.github/workflows/manual-nginxinc.yml @@ -3,19 +3,44 @@ name: Manual Push NginxInc Image to DockerHub on: workflow_dispatch: +env: + DOCKERHUB_IMAGE: signalsciences/sigsci-nginxinc-ingress-controller + DISTRIBUTION: alpine + UPSTREAM_NGINX_INGRESS_VERSION: 2.3.0 + jobs: - deploy: + buildpush_to_dockerhub: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_API_TOKEN }} - - name: Build and Push image to docker Hub - env: - TAG: 2.3.0 - REPO: signalsciences/sigsci-nginxinc-ingress-controller - run: | - docker buildx build . --file Dockerfile.nginxinc --build-arg NGINX_INGRESS_VERSION=${TAG} --tag ${REPO}:${TAG} --tag ${REPO}:latest --push . + + - name: Build and push + uses: docker/build-push-action@v4 + with: + cache-from: type=gha + cache-to: type=gha,mode=max + context: . + file: Dockerfile.nginxinc + build-args: | + NGINX_INGRESS_VERSION=${{ env.UPSTREAM_NGINX_INGRESS_VERSION }} + CONTAINER_BASE=${{ env.DISTRIBUTION }} + push: ${{ !env.ACT }} + tags: >- + ${{ env.DOCKERHUB_IMAGE }}:${{ env.UPSTREAM_NGINX_INGRESS_VERSION }},${{ env.DOCKERHUB_IMAGE}}:latest, + + - name: Echo output + run: >- + echo "::set-output + name=image::${{ env.DOCKERHUB_IMAGE}}:latest,${{ env.DOCKERHUB_IMAGE }}:${{ env.UPSTREAM_NGINX_INGRESS_VERSION }}"