use multiple runners for the multi-arch build
All checks were successful
CI / Static Analysis (pre-commit) (pull_request) Successful in 1m5s
CI / Tests (pull_request) Successful in 1m0s
CI / Build and push image (map[platform:linux/arm64 runner:ubuntu-arm-latest]) (pull_request) Successful in 57s
CI / Build and push image (map[platform:linux/amd64 runner:ubuntu-latest]) (pull_request) Successful in 1m17s
All checks were successful
CI / Static Analysis (pre-commit) (pull_request) Successful in 1m5s
CI / Tests (pull_request) Successful in 1m0s
CI / Build and push image (map[platform:linux/arm64 runner:ubuntu-arm-latest]) (pull_request) Successful in 57s
CI / Build and push image (map[platform:linux/amd64 runner:ubuntu-latest]) (pull_request) Successful in 1m17s
This commit is contained in:
parent
e0c6573b19
commit
d002b0f2f8
@ -63,46 +63,42 @@ jobs:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
build:
|
||||
name: Build and push image
|
||||
runs-on: ${{ matrix.runner }}
|
||||
runs-on: ${{ matrix.arch.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner: [ubuntu-latest, ubuntu-arm-latest]
|
||||
arch:
|
||||
- runner: ubuntu-latest
|
||||
platform: linux/amd64
|
||||
- runner: ubuntu-arm-latest
|
||||
platform: linux/arm64
|
||||
permissions:
|
||||
packages: write
|
||||
needs: tests
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Prepare
|
||||
run: |
|
||||
platform=${{ matrix.arch.platform }}
|
||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||
- name: Generate metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
- name: Login to the Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: brosner.dev
|
||||
username: brosner
|
||||
password: ${{ secrets.CI_TOKEN }}
|
||||
- name: Generate metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=sha
|
||||
labels: |
|
||||
org.opencontainers.image.title=teufa
|
||||
org.opencontainers.image.description=teufa container image
|
||||
org.opencontainers.image.source=https://brosner.dev/brosner/teufa
|
||||
org.opencontainers.image.licenses=MIT
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Setup docker buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v6
|
||||
if: gitea.ref == 'refs/heads/main'
|
||||
with:
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
annotations: ${{ steps.meta.outputs.annotations }}
|
||||
target: prod
|
||||
platforms: ${{ matrix.runner == 'ubuntu-latest' && 'linux/amd64' || 'linux/arm64' }}
|
||||
push: true
|
||||
platforms: ${{ matrix.arch.platform }}
|
||||
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
|
||||
|
Loading…
x
Reference in New Issue
Block a user