Skip to content

add multi-architecture container build #1

add multi-architecture container build

add multi-architecture container build #1

Workflow file for this run

name: Build
on:
push:
tags:
- "**"
branches:
- "**"
pull_request:
env:
application_prefix: golang
use_cgo: 0
jobs:
build_container:
name: Build Container
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.22.x"]
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- id: setup-qemu
uses: docker/setup-qemu-action@v3
with:
platforms: arm64,amd64
- id: setup-buildx
uses: docker/setup-buildx-action@v3
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create container tags
id: container_tags
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
tags: |
type=schedule
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
flavor: |
latest=true
- name: Build container
uses: docker/build-push-action@v5
timeout-minutes: 30
with:
context: .
platforms: linux/arm64,linux/amd64
provenance: mode=max
push: ${{ github.event_name != 'pull_request' || github.ref_name == github.event.repository.default_branch }}
tags: ${{ steps.container_tags.outputs.tags }}
labels: ${{ steps.container_tags.outputs.labels }}