Skip to content

Commit

Permalink
Switching to non-parallelised docker image build and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
detro committed Apr 20, 2024
1 parent cf5c4fa commit 1d85b5e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 38 deletions.
25 changes: 2 additions & 23 deletions .github/workflows/crates.io-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,13 @@ jobs:
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_PUBLISH_TOKEN }}

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

needs:
- publish-crates_io

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

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)

publish-hub_docker_com:
name: Publish to hub.docker.com
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 }}
28 changes: 28 additions & 0 deletions .github/workflows/hub.docker.com-manual_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Manually Publish Docker Image

on:

# This is for when, occasionally, we need to manually publish a docker image
workflow_dispatch:
inputs:

target-platforms:
type: string
default: linux/amd64,linux/arm64
description: Platforms to target when publishing the docker image

release-version:
required: true
type: string
description: Version to publish as docker image (eg. 'vX.Y.Z')

jobs:
manually_publish-hub_docker_com:
name: Publish to hub.docker.com
uses: ./.github/workflows/hub.docker.com-publish.yml
with:
release-version: ${{ inputs.release-version }}
target-platforms: ${{ inputs.target-platforms }}
secrets:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
26 changes: 11 additions & 15 deletions .github/workflows/hub.docker.com-publish.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,56 @@
name: Publish Docker Image

on:

# This workflow is designed to be invoked by others, not triggered by events.
workflow_call:
inputs:

target-platforms:
type: string
default: linux/amd64,linux/arm64
description: Platforms to target when publishing the docker image

dockerhub-org:
type: string
default: kafkesc
description: Docker Hub organization under which to publish the docker image

dockerhub-imagename:
type: string
default: ksunami
description: Name of the docker image to publish

release-version:
required: true
type: string
description: Version to publish as docker image (eg. 'vX.Y.Z')

secrets:

dockerhub-username:
required: true
description: Docker Hub username to use when publishing the image

dockerhub-password:
required: true
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 All @@ -63,4 +59,4 @@ jobs:
KSUNAMI_VERSION=${{ inputs.release-version }}
tags: |
${{ inputs.dockerhub-org }}/${{ inputs.dockerhub-imagename }}:latest
${{ inputs.dockerhub-org }}/${{ inputs.dockerhub-imagename }}:${{ inputs.release-version }}
${{ inputs.dockerhub-org }}/${{ inputs.dockerhub-imagename }}:${{ inputs.release-version }}

0 comments on commit 1d85b5e

Please sign in to comment.