- Replace type=gha cache (disabled on this runner) with type=registry cache - Upgrade docker/build-push-action v5 → v6 (matches whisper-rtx2080 pattern) - Switch auth to REGISTRY_USERNAME/REGISTRY_TOKEN repo secrets - Split into two parallel jobs (build-cpu / build-gpu) for visibility - Use github.ref conditions (Gitea compat) instead of is_default_branch
103 lines
3.7 KiB
YAML
103 lines
3.7 KiB
YAML
name: Build and publish Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
tags:
|
|
- 'v*.*.*'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: git.sal.giize.com
|
|
IMAGE_NAME: mozempk/trueref
|
|
|
|
jobs:
|
|
# ── CPU image ──────────────────────────────────────────────────────────────
|
|
build-cpu:
|
|
name: Build and push CPU image
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
# On a version tag (v1.2.3): latest, cpu, cpu-1.2.3, 1.2.3
|
|
# On branch push (main/master): latest, cpu
|
|
- name: Docker metadata (CPU)
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}
|
|
type=raw,value=cpu,enable=${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}
|
|
type=semver,pattern={{version}},prefix=cpu-
|
|
type=semver,pattern={{version}}
|
|
|
|
- name: Build and push CPU image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
# Registry-backed layer cache — works without the GHA cache service.
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-cpu
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-cpu,mode=max
|
|
platforms: linux/amd64
|
|
|
|
# ── GPU image ──────────────────────────────────────────────────────────────
|
|
build-gpu:
|
|
name: Build and push GPU image
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
# On a version tag (v1.2.3): gpu, gpu-1.2.3
|
|
# On branch push (main/master): gpu
|
|
- name: Docker metadata (GPU)
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=raw,value=gpu,enable=${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}
|
|
type=semver,pattern={{version}},prefix=gpu-
|
|
|
|
- name: Build and push GPU image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Dockerfile.gpu
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-gpu
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-gpu,mode=max
|
|
platforms: linux/amd64
|