Skip to content

Build with QEMU

Build with QEMU #36

Workflow file for this run

name: "Build with QEMU"
# Controls when the workflow will run
on:
push:
branches: ['main']
tags:
- 'v*.*.*'
pull_request:
branches: ['main']
schedule:
- cron: '32 6 * * 0'
# Run builds on Sunday @ 06:32
env:
TEST_TAG: ministryofjustice/wordpress-base-fpm:test
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
# First, checkout
- name: Checkout
uses: actions/checkout@v4
# QEMU; multi-arch stuff
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# get buildx - build multi-arch stuff
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
# Access Docker Hub
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Setup test build for PRs
- name: Test - build and export to Docker
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ${{ env.TEST_TAG }}
# Gather meta for the builds
- name: Docker meta
if: github.event_name != 'pull_request'
id: wordpress-base-meta
uses: docker/metadata-action@v5
with:
images: ministryofjustice/wordpress-base-fpm
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
flavor: |
latest=true
# perform the builds
- name: Build and push
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v5
with:
context: .
platforms: |
linux/amd64
linux/arm64/v8
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.wordpress-base-meta.outputs.tags }}
labels: ${{ steps.wordpress-base-meta.outputs.labels }}