diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 22087b7d8..8aa642584 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -29,7 +29,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USER }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: "Download and verify artifact" + - name: "Download and Verify Artifact" run: | set -euo pipefail ARTIFACT_URL="${{ inputs.artifact_url }}" @@ -40,12 +40,20 @@ jobs: curl -fSL "${ARTIFACT_URL}.sha512" -o /tmp/apache-bifromq-${{ inputs.version }}.tar.gz.sha512 cd /tmp sha512sum --check "apache-bifromq-${{ inputs.version }}.tar.gz.sha512" - - name: "Build image" + - name: "Build and Push Multi-Arch Image" run: | set -euo pipefail - chmod +x release/docker-build.sh - release/docker-build.sh -t "${IMAGE_REPO}:${{ inputs.version }}" "/tmp/apache-bifromq-${{ inputs.version }}.tar.gz" - - name: "Push image" - run: | - set -euo pipefail - docker push "${IMAGE_REPO}:${{ inputs.version }}" \ No newline at end of file + ctx_dir="/tmp/bifromq-docker-build-context" + rm -rf "$ctx_dir" + mkdir -p "$ctx_dir" + + cp Dockerfile "$ctx_dir/Dockerfile" + cp "/tmp/apache-bifromq-${{ inputs.version }}.tar.gz" "$ctx_dir/" + cp "/tmp/apache-bifromq-${{ inputs.version }}.tar.gz.sha512" "$ctx_dir/" + + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --build-arg BIFROMQ_VERSION="${{ inputs.version }}" \ + -t "${IMAGE_REPO}:${{ inputs.version }}" \ + --push \ + "$ctx_dir" diff --git a/release/docker-build.sh b/release/docker-build.sh index e3918dd3c..b3b52d386 100755 --- a/release/docker-build.sh +++ b/release/docker-build.sh @@ -7,9 +7,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY