Skip to content

Commit

Permalink
chore: multiplatform docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
qrayven committed Feb 27, 2025
1 parent fb5b646 commit 23a2679
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/publish-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,35 @@ jobs:
with:
ref: ${{ github.event.inputs.branch }}

- name: Set up QEMU (for cross-arch emulation)
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
username: ${{ secrets.IOTALEDGER_DOCKER_USERNAME }}
password: ${{ secrets.IOTALEDGER_DOCKER_PASSWORD }}

- name: Build image with build.sh
- name: Build docker image (DRY-RUN)
if: ${{ github.event.inputs.is-dry-run == 'true' }}
run: |
chmod +x docker/build.sh
ENTRY_BINARY=${{ matrix.image.name }} docker/build.sh -t ${{ matrix.image.repo }}:${{ github.event.inputs.tag }}
ENTRY_BINARY=${{ matrix.image.name }} docker/build.sh \
-t ${{ matrix.image.repo }}:${{ github.event.inputs.tag }} \
--platform linux/amd64,linux/arm64 \
--load
- name: Push docker image
- name: Build & Push docker image
if: ${{ github.event.inputs.is-dry-run != 'true' }}
run: |
docker push ${{ matrix.image.repo }}:${{ github.event.inputs.tag }}
chmod +x docker/build.sh
ENTRY_BINARY=${{ matrix.image.name }} docker/build.sh \
-t ${{ matrix.image.repo }}:${{ github.event.inputs.tag }} \
--platform linux/amd64,linux/arm64 \
--push
# - name: Docker Hub Description for ${{ matrix.image.repo }}
# if: ${{ github.event.inputs.is-dry-run == 'false'}}
Expand Down
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ echo "git revision: \t$GIT_REVISION"
echo "binary: \t$ENTRY_BINARY"
echo

docker build -f "$DOCKERFILE" "$REPO_ROOT" \
docker buildx build -f "$DOCKERFILE" "$REPO_ROOT" \
--build-arg GIT_REVISION="$GIT_REVISION" \
--build-arg BUILD_DATE="$BUILD_DATE" \
--build-arg ENTRY_BINARY="$ENTRY_BINARY" \
Expand Down

0 comments on commit 23a2679

Please sign in to comment.