mirror of
https://github.com/rybbit-io/rybbit.git
synced 2025-05-10 20:05:38 +02:00
ci: fix broken amd64 images build, use QEMU for multi-arch build (#165)
This commit is contained in:
parent
ee65124ffa
commit
b632eef780
1 changed files with 20 additions and 27 deletions
47
.github/workflows/docker-publish.yml
vendored
47
.github/workflows/docker-publish.yml
vendored
|
@ -6,17 +6,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- platform: linux/amd64
|
|
||||||
runner: ubuntu-22.04
|
|
||||||
- platform: linux/arm64
|
|
||||||
runner: ubuntu-22.04-arm
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.runner || 'ubuntu-22.04' }}
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
@ -25,8 +15,15 @@ jobs:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# 1) Register QEMU emulators for cross-platform builds
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
# 2) Create and use a Docker Buildx builder instance
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
buildkitd-flags: --debug
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
@ -39,24 +36,22 @@ jobs:
|
||||||
id: meta_backend
|
id: meta_backend
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
# Images will be ghcr.io/rybbit-io/rybbit-backend
|
|
||||||
images: ghcr.io/${{ github.repository_owner }}/rybbit-backend
|
images: ghcr.io/${{ github.repository_owner }}/rybbit-backend
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch # Creates tag like :master
|
type=ref,event=branch
|
||||||
type=sha # Creates tag like :<commit_sha_short>
|
type=sha
|
||||||
# Tags 'master' branch pushes additionally with 'latest'
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
|
||||||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
|
||||||
|
|
||||||
- name: Build and push Backend Docker image
|
- name: Build and push Backend Docker image (multi-arch)
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./server #
|
context: ./server
|
||||||
file: ./server/Dockerfile
|
file: ./server/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
platforms: ${{ matrix.platform }} # linux/amd64 or linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: ${{ steps.meta_backend.outputs.tags }}
|
tags: ${{ steps.meta_backend.outputs.tags }}
|
||||||
labels: ${{ steps.meta_backend.outputs.labels }}
|
labels: ${{ steps.meta_backend.outputs.labels }}
|
||||||
# # Optional: Enable build cache for potentially faster builds
|
# Optional: enable build cache for speed
|
||||||
# cache-from: type=gha,scope=${{ github.workflow }}-backend
|
# cache-from: type=gha,scope=${{ github.workflow }}-backend
|
||||||
# cache-to: type=gha,scope=${{ github.workflow }}-backend,mode=max
|
# cache-to: type=gha,scope=${{ github.workflow }}-backend,mode=max
|
||||||
|
|
||||||
|
@ -64,23 +59,21 @@ jobs:
|
||||||
id: meta_client
|
id: meta_client
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
# Images will be ghcr.io/rybbit-io/rybbit-client
|
|
||||||
images: ghcr.io/${{ github.repository_owner }}/rybbit-client
|
images: ghcr.io/${{ github.repository_owner }}/rybbit-client
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=sha
|
type=sha
|
||||||
# Tags 'master' branch pushes additionally with 'latest'
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
|
||||||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
|
||||||
|
|
||||||
- name: Build and push Client Docker image
|
- name: Build and push Client Docker image (multi-arch)
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./client
|
context: ./client
|
||||||
file: ./client/Dockerfile
|
file: ./client/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
platforms: ${{ matrix.platform }} # linux/amd64 or linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: ${{ steps.meta_client.outputs.tags }}
|
tags: ${{ steps.meta_client.outputs.tags }}
|
||||||
labels: ${{ steps.meta_client.outputs.labels }}
|
labels: ${{ steps.meta_client.outputs.labels }}
|
||||||
# # Optional: Enable build cache for potentially faster builds
|
# Optional: enable build cache for speed
|
||||||
# cache-from: type=gha,scope=${{ github.workflow }}-client
|
# cache-from: type=gha,scope=${{ github.workflow }}-client
|
||||||
# cache-to: type=gha,scope=${{ github.workflow }}-client,mode=max
|
# cache-to: type=gha,scope=${{ github.workflow }}-client,mode=max
|
Loading…
Add table
Add a link
Reference in a new issue