From bef18493c40cbacc862f6029e5d3eef9ee734552 Mon Sep 17 00:00:00 2001 From: Adrian Coman <1664229+azun@users.noreply.github.com> Date: Wed, 13 Mar 2024 23:13:07 +0200 Subject: [PATCH] Zookeeper image build for arm and x64 --- .github/workflows/build-push-docker.yml | 63 +++++++++++++++---------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index fef58534..81e68728 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -32,40 +32,53 @@ jobs: ref="${ref////-}" echo $ref echo ::set-output name=tag::$ref - - name: Build and push zookeeper Apache image - uses: docker/build-push-action@v1 - if: ${{ startsWith(github.ref, 'refs/tags/zk') }} + echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + if: startsWith(github.ref, 'refs/tags/') + uses: docker/login-action@v3 with: - path: docker/zookeeper-image username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - repository: adobe/zookeeper - tags: 3.8.3-apache-${{ steps.vars.outputs.tag }} - add_git_labels: true - always_pull: true + + - name: Build and push zookeeper Apache image + uses: docker/build-push-action@v5 + if: ${{ startsWith(github.ref, 'refs/tags/zk') }} + with: + context: docker/zookeeper-image + platforms: linux/amd64,linux/arm64 + tags: adobe/zookeeper:3.8.3-apache-${{ steps.vars.outputs.tag }} push: ${{ startsWith(github.ref, 'refs/tags/zk') }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.html_url }} + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.revision=${{ github.sha }} + - name: Build and push zookeeper image if: ${{ !startsWith(github.ref, 'refs/tags/zk') }} - uses: docker/build-push-action@v1 + uses: docker/build-push-action@v5 with: - path: docker - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: adobe/zookeeper - tags: 3.8.3-${{ steps.vars.outputs.tag }} - add_git_labels: true - always_pull: true + context: docker + platforms: linux/amd64,linux/arm64 + tags: adobe/zookeeper:3.8.3-${{ steps.vars.outputs.tag }} push: ${{ startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/tags/zk') }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.html_url }} + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.revision=${{ github.sha }} + - name: Build and push zookeeper-operator image if: ${{ !startsWith(github.ref, 'refs/tags/zk') }} - uses: docker/build-push-action@v1 + uses: docker/build-push-action@v5 with: - dockerfile: Dockerfile - build_args: VERSION=${{ steps.vars.outputs.tag }},GIT_SHA=${{ github.sha }} - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: adobe/zookeeper-operator - tag_with_ref: true - add_git_labels: true - always_pull: true + context: . + tags: adobe/zookeeper-operator:${{ steps.vars.outputs.tag }} push: ${{ startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/tags/zk') }} + labels: | + org.opencontainers.image.source=${{ github.event.repository.html_url }} + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.revision=${{ github.sha }}