ci: Fix multi-arch builds (#165) #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and release edge image of branch "develop" | |
on: | |
push: | |
branches: | |
- 'develop' | |
permissions: | |
contents: read | |
packages: write | |
env: | |
DOCKER_IMAGE: ghcr.io/kereis/traefik-certs-dumper | |
jobs: | |
release-edge: | |
name: Release edge build normal (Docker) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Prepare tags for normal build | |
id: docker_meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.DOCKER_IMAGE }} | |
tags: | | |
type=edge,branch=develop | |
flavor: | | |
latest=false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
driver-opts: network=host | |
- name: Cache Docker layers | |
uses: actions/[email protected] | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Build image | |
uses: docker/build-push-action@v3 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
context: . | |
file: ./docker/Dockerfile | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
push: true | |
release-edge-alpine: | |
name: Release edge build Alpine | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Prepare tags for normal build | |
id: docker_meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.DOCKER_IMAGE }} | |
tags: | | |
type=edge,branch=develop | |
flavor: | | |
latest=false | |
suffix=-alpine | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/[email protected] | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Build and publish image | |
uses: docker/build-push-action@v3 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
context: . | |
file: ./alpine/Dockerfile | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
push: true |