Skip to content

Publish Docker image multi-arch #9

Publish Docker image multi-arch

Publish Docker image multi-arch #9

Workflow file for this run

# https://docs.docker.com/build/ci/github-actions/multi-platform/
name: Publish Docker image multi-arch
on:
push:
branches:
- master
- devel
workflow_dispatch:
schedule:
- cron: "0 13 * * *"
env:
IMAGE: pipeittodevnull/nginx-certbot
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
branch:
- master
- devel
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
context: git
images: ${{ env.IMAGE }}
flavor: latest=auto
tags: |
type=raw,value={{branch}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and load amd64
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate SBOM
uses: anchore/sbom-action@v0
with:
image: ${{ env.IMAGE }}
format: spdx-json
upload-artifact: true
upload-artifact-retention: 7
- name: Build and push multiarch
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}