Skip to content

Commit

Permalink
Switch to having 'docker/build-push-action' handle both platforms bui…
Browse files Browse the repository at this point in the history
…ld and push in parallel (slower but it works)
  • Loading branch information
detro committed Apr 19, 2024
1 parent 695ec7d commit d3faae5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
21 changes: 2 additions & 19 deletions .github/workflows/crates.io-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_PUBLISH_TOKEN }}

publish-hub_docker_com-linux_amd64:
name: Publish to hub.docker.com (linux/amd64)
publish-hub_docker_com:
name: Publish to hub.docker.com

needs:
- publish-crates_io
Expand All @@ -48,24 +48,7 @@ jobs:

with:
release-version: ${{ github.ref_name }}
target-platforms: linux/amd64

secrets:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}

publish-hub_docker_com-linux_arm64:
name: Publish to hub.docker.com (linux/arm64)

needs:
- publish-crates_io

uses: ./.github/workflows/hub.docker.com-publish.yml

with:
release-version: ${{ github.ref_name }}
target-platforms: linux/arm64

secrets:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
20 changes: 12 additions & 8 deletions .github/workflows/hub.docker.com-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish Docker Image

on:
# Enable the occasional manual trigger
workflow_dispatch:

# This workflow is designed to be invoked by others, not triggered by events.
workflow_call:
inputs:
Expand Down Expand Up @@ -36,25 +39,26 @@ on:
description: Docker Hub password to use when publishing the image (e.g. the API token)

jobs:
publish:
name: Build & Publish ${{ inputs.dockerhub-org }}/${{ inputs.dockerhub-imagename }}:${{ inputs.release-version }} for ${{ inputs.target-platforms }}
build-and-push:
name: Build&Push ${{ inputs.dockerhub-org }}/${{ inputs.dockerhub-imagename }}:${{ inputs.release-version }} (${{ inputs.target-platforms })

runs-on: ubuntu-latest

steps:

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.dockerhub-username }}
password: ${{ secrets.dockerhub-password }}

- name: Set-up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ inputs.target-platforms }}

- name: Build & Push
- name: Build + Push
uses: docker/build-push-action@v5
with:
push: true
Expand Down

0 comments on commit d3faae5

Please sign in to comment.