Add support for multi-platform builds in Docker workflow

This commit is contained in:
2026-01-18 20:44:53 +01:00
parent b0f2fef58f
commit 304c86129c

View File

@@ -26,6 +26,14 @@ on:
Path to the Dockerfile relative to the repository root. Path to the Dockerfile relative to the repository root.
Example: ./Dockerfile or ./services/api/Dockerfile Example: ./Dockerfile or ./services/api/Dockerfile
platforms:
type: string
required: false
default: linux/amd64,linux/arm64
description: >
Comma-separated list of target platforms to build.
Example: linux/amd64,linux/arm64
jobs: jobs:
build-and-push: build-and-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -37,6 +45,11 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up QEMU (for cross-arch builds)
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -66,6 +79,7 @@ jobs:
with: with:
context: ${{ inputs.build_context }} context: ${{ inputs.build_context }}
file: ${{ inputs.file_path }} file: ${{ inputs.file_path }}
platforms: ${{ inputs.platforms }}
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}