Skip to content

Commit

Permalink
Multiarch
Browse files Browse the repository at this point in the history
  • Loading branch information
mgax committed Oct 17, 2024
1 parent b8f8b61 commit 73d1afa
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create and publish a Docker image
name: Create and publish multi-arch Docker images

on:
push:
Expand All @@ -10,7 +10,15 @@ env:

jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
matrix:
runner: [ubuntu-latest, self-hosted-arm64]
include:
- runner: ubuntu-latest
platform: linux/amd64
- runner: self-hosted-arm64
platform: linux/arm64
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
Expand All @@ -19,6 +27,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

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

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
Expand All @@ -37,5 +48,15 @@ jobs:
with:
context: .
push: true
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Merge multi-arch images
if: matrix.runner == 'ubuntu-latest'
run: |
docker buildx imagetools create -t ${{ steps.meta.outputs.tags }} \
${{ steps.meta.outputs.tags }}:linux-amd64 \
${{ steps.meta.outputs.tags }}:linux-arm64

0 comments on commit 73d1afa

Please sign in to comment.