* ci(docker): publish multi-arch images (linux/amd64 + linux/arm64) The Dockerfile was already arch-aware (TARGETARCH in the Jellyfin apt repo); this adds linux/arm64 to the buildx platform list so the pushed manifest list serves both x86 servers and arm64 hosts (Apple Silicon, Graviton, Pi 4/5). Verified locally on the arm64 runner host: image builds and both silo and jellyfin-ffmpeg run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * ci(docker): move image builds to GitHub-hosted runners Replaces the single self-hosted job with a per-arch matrix (ubuntu-latest for amd64, ubuntu-24.04-arm for arm64) so each platform builds natively with no emulation, pushing by digest, plus a merge job that stitches the digests into one tagged manifest list. Layer caching moves from the persistent local builder to type=gha per-platform scopes. The private-SDK constraint that originally forced self-hosted no longer applies: silo-plugin-sdk is public and resolves from proxy.golang.org. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * ci(docker): use normalized IMAGE_LC in merge-job metadata step Not a functional fix — metadata-action lowercases the images input itself (proven by run 29768620803) — but keeps all image references in the merge job on the explicit IMAGE_LC form. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
185 lines
5.3 KiB
YAML
185 lines
5.3 KiB
YAML
name: Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: docker-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
GOPROXY: https://proxy.golang.org,direct
|
|
GOPRIVATE: github.com/Silo-Server/*
|
|
GONOSUMDB: github.com/Silo-Server/*
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: linux/amd64
|
|
runner: ubuntu-latest
|
|
- platform: linux/arm64
|
|
runner: ubuntu-24.04-arm
|
|
runs-on: ${{ matrix.runner }}
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Prepare platform slug and lowercase image name
|
|
run: |
|
|
echo "PLATFORM_PAIR=${PLATFORM//\//-}" >> "$GITHUB_ENV"
|
|
echo "IMAGE_LC=${IMAGE_NAME,,}" >> "$GITHUB_ENV"
|
|
env:
|
|
PLATFORM: ${{ matrix.platform }}
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: "22"
|
|
cache: "pnpm"
|
|
cache-dependency-path: web/pnpm-lock.yaml
|
|
|
|
- name: Install frontend dependencies
|
|
working-directory: web
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build frontend assets
|
|
working-directory: web
|
|
run: pnpm run build
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
cache-dependency-path: go.sum
|
|
|
|
- name: Reject committed local SDK replaces
|
|
run: |
|
|
if grep -Eq '^replace github.com/Silo-Server/silo-plugin-sdk => /' go.mod; then
|
|
echo "go.mod contains a machine-local silo-plugin-sdk replace."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Validate SDK resolves from the module graph
|
|
env:
|
|
GOWORK: off
|
|
run: |
|
|
sdk_module_json="$(mktemp)"
|
|
go list -m -json github.com/Silo-Server/silo-plugin-sdk > "$sdk_module_json"
|
|
if grep -q '"Main": true' "$sdk_module_json"; then
|
|
echo "silo-plugin-sdk resolved from the local workspace instead of go.mod."
|
|
cat "$sdk_module_json"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- 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
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
- name: Build and push by digest
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: ${{ matrix.platform }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-contexts: |
|
|
frontend_dist=./web/dist
|
|
build-args: |
|
|
BUILD_REVISION=${{ github.sha }}
|
|
BUILD_DIRTY=false
|
|
cache-from: type=gha,scope=docker-${{ env.PLATFORM_PAIR }}
|
|
cache-to: type=gha,scope=docker-${{ env.PLATFORM_PAIR }},mode=max
|
|
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_LC }},push-by-digest=true,name-canonical=true,push=true
|
|
|
|
- name: Export digest
|
|
run: |
|
|
mkdir -p "${RUNNER_TEMP}/digests"
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
touch "${RUNNER_TEMP}/digests/${digest#sha256:}"
|
|
|
|
- name: Upload digest
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: digests-${{ env.PLATFORM_PAIR }}
|
|
path: ${{ runner.temp }}/digests/*
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
merge:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
permissions:
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Prepare lowercase image name
|
|
run: echo "IMAGE_LC=${IMAGE_NAME,,}" >> "$GITHUB_ENV"
|
|
|
|
- name: Download digests
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: ${{ runner.temp }}/digests
|
|
pattern: digests-*
|
|
merge-multiple: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- 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
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_LC }}
|
|
tags: |
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=sha,prefix=,format=short
|
|
|
|
- name: Create and push manifest list
|
|
working-directory: ${{ runner.temp }}/digests
|
|
run: |
|
|
# shellcheck disable=SC2046
|
|
docker buildx imagetools create \
|
|
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
$(printf "${REGISTRY}/${IMAGE_LC}@sha256:%s " *)
|
|
|
|
- name: Inspect manifest list
|
|
run: |
|
|
docker buildx imagetools inspect "${REGISTRY}/${IMAGE_LC}:${GITHUB_SHA::7}"
|