Skip to content

Add multiarch Docker images #220

Add multiarch Docker images

Add multiarch Docker images #220

name: Protobuf Docker Image
on:
push:
tags:
- "**"
branches:
- main
pull_request:
branches:
- main
paths:
- .github/workflows/protobuf-dockerimage.yml
- protobuf/Dockerfile
- protobuf/protoc-wrapper
jobs:
build:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
name=otel/build-protobuf,enable=${{ github.event_name != 'pull_request' }}
name=localhost:5000/otel/build-protobuf
tags: |
type=edge
type=ref,event=pr
type=semver,pattern={{version}}
- name: Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: DockerHub Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: github.event_name != 'pull_request'
- name: Build Docker image
uses: docker/build-push-action@v5
id: build-push
with:
context: "protobuf/."
cache-from: type=gha,scope=protobuf
cache-to: type=gha,scope=protobuf,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
platforms: "linux/amd64"
# platforms: "linux/arm64, linux/amd64"
push: true
pull: true
sbom: true
provenance: mode=max
no-cache: ${{ github.event_name != 'pull_request' }}