Skip to content

Commit

Permalink
build: multi arch optimization (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
incubator4 authored Feb 1, 2024
1 parent 79a83cf commit e825f13
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@ name: build & deploy
on:
push:
branches:
- "develop"
- develop
tags:
- "*"

jobs:
build:
runs-on: self-hosted
runs-on:
- self-hosted
- ${{ matrix.arch }}
strategy:
matrix:
os:
- linux
arch:
- amd64
- arm64
permissions:
contents: read
packages: write
Expand All @@ -18,11 +27,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -48,12 +52,13 @@ jobs:
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ matrix.arch }},enable={{is_default_branch}}
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=ref,event=branch
type=ref,event=pr
type=sha,prefix={{branch}}-,enable=${{ !startsWith(github.ref, 'refs/tags') }},event=branch
type=sha,prefix={{branch}}-,enable=${{ !startsWith(github.ref, 'refs/tags') && github.event_name != 'pull_request' }},event=branch
- name: Build and push
uses: docker/build-push-action@v4
Expand All @@ -62,6 +67,6 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
platforms: ${{ matrix.os }}/${{ matrix.arch }}
cache-from: type=gha,scope=docker-release
cache-to: type=gha,mode=max,scope=docker-release

0 comments on commit e825f13

Please sign in to comment.