mirror of
https://github.com/CloudNebulaProject/barycenter.git
synced 2026-04-10 21:20:41 +00:00
feat: use native ARM64 runners with matrix strategy for faster builds
This commit is contained in:
parent
876c659292
commit
609f39813f
1 changed files with 55 additions and 7 deletions
62
.github/workflows/release.yml
vendored
62
.github/workflows/release.yml
vendored
|
|
@ -10,12 +10,19 @@ env:
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-platform:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.runner }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
id-token: write
|
id-token: write
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- platform: linux/amd64
|
||||||
|
runner: ubuntu-latest
|
||||||
|
- platform: linux/arm64
|
||||||
|
runner: ubuntu-24.04-arm64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
@ -45,18 +52,20 @@ jobs:
|
||||||
org.opencontainers.image.title=Barycenter
|
org.opencontainers.image.title=Barycenter
|
||||||
org.opencontainers.image.description=OpenID Connect Identity Provider with federation and auto-registration
|
org.opencontainers.image.description=OpenID Connect Identity Provider with federation and auto-registration
|
||||||
org.opencontainers.image.vendor=${{ github.repository_owner }}
|
org.opencontainers.image.vendor=${{ github.repository_owner }}
|
||||||
|
flavor: |
|
||||||
|
suffix=-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push platform-specific image
|
||||||
id: build
|
id: build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: ${{ matrix.platform }}
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha,scope=${{ matrix.platform }}
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
|
||||||
build-args: |
|
build-args: |
|
||||||
VERSION=${{ github.ref_name }}
|
VERSION=${{ github.ref_name }}
|
||||||
REVISION=${{ github.sha }}
|
REVISION=${{ github.sha }}
|
||||||
|
|
@ -68,9 +77,48 @@ jobs:
|
||||||
subject-digest: ${{ steps.build.outputs.digest }}
|
subject-digest: ${{ steps.build.outputs.digest }}
|
||||||
push-to-registry: true
|
push-to-registry: true
|
||||||
|
|
||||||
|
create-manifest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build-platform
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata for manifest
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}},enable=${{ !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') && !contains(github.ref_name, 'rc') }}
|
||||||
|
type=semver,pattern={{major}},enable=${{ !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') && !contains(github.ref_name, 'rc') }}
|
||||||
|
type=sha,prefix=sha-
|
||||||
|
|
||||||
|
- name: Create and push multi-platform manifest
|
||||||
|
run: |
|
||||||
|
# Extract tags into an array
|
||||||
|
TAGS=$(echo '${{ steps.meta.outputs.tags }}' | tr '\n' ' ')
|
||||||
|
|
||||||
|
# For each tag, create a manifest combining both platform images
|
||||||
|
for TAG in $TAGS; do
|
||||||
|
echo "Creating manifest for $TAG"
|
||||||
|
docker buildx imagetools create -t $TAG \
|
||||||
|
${TAG}-amd64 \
|
||||||
|
${TAG}-arm64
|
||||||
|
done
|
||||||
|
|
||||||
create-github-release:
|
create-github-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build-and-push
|
needs: create-manifest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue