Until now `docker compose up` built the image on the user's machine: a compiler toolchain, every dev dependency, a few minutes of CPU — on a Raspberry Pi considerably more. The compose files now pull ghcr.io/tillheidrich/klarbild:1, built by .github/workflows/image.yml for linux/amd64 and linux/arm64. `:1` follows every 1.x release, so an update is `docker compose pull && docker compose up -d`. `build: .` is one commented line away for anyone who prefers to build. The Dockerfile has two stages now. The runtime stage carries the built server, production dependencies and the migrations — no compiler, no dev dependencies, no source tree. argon2 and sharp ship prebuilt binaries for both architectures, so python/make/g++ are gone entirely. It runs as the `node` user (uid 1000); a fresh named volume at /data inherits that ownership. Verified locally: image builds, boots against Postgres, applies all 17 migrations, prints the first-run password, passes its healthcheck, accepts an upload as the unprivileged user and returns an A4 sheet that measures 210.00 x 297.00 mm.
63 lines
1.7 KiB
YAML
63 lines
1.7 KiB
YAML
name: Container image
|
|
|
|
# Builds the image that docker-compose.yaml pulls, for amd64 and arm64
|
|
# (a Raspberry Pi 4/5 or an ARM VPS runs the same image).
|
|
#
|
|
# push to main -> ghcr.io/tillheidrich/klarbild:edge
|
|
# tag v1.2.3 -> :1.2.3, :1.2, :1 and :latest
|
|
#
|
|
# Nothing to configure: the workflow pushes with its own GITHUB_TOKEN.
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*.*.*']
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
concurrency:
|
|
group: image-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- uses: docker/setup-qemu-action@v3
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository_owner }}/klarbild
|
|
tags: |
|
|
type=edge,branch=main
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
labels: |
|
|
org.opencontainers.image.title=Klarbild
|
|
org.opencontainers.image.description=Self-hosted print studio: pictures on paper at exactly the size you asked for.
|
|
org.opencontainers.image.licenses=AGPL-3.0-only
|
|
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|