Files
Archivum/.gitea/workflows/build.yaml
Bjorn Blomberg 952ff5f951
All checks were successful
build-and-push / build (push) Successful in 1m4s
ci: re-trigger build (previous run interrupted by host overload)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 22:39:51 +02:00

42 lines
1.6 KiB
YAML

name: build-and-push
# Bygger Archivum-imagen på Pi5-runnern (arm64, nativt) och pushar till den lokala
# registryn. Ett enda multi-stage-bygge (frontend -> backend -> runtime), så
# build-context måste vara repo-roten (Dockerfile COPY:ar frontend/, backend/ och
# docker/entrypoint.sh). localhost:5000 trustas automatiskt av Docker på Pi5
# (ingen insecure-registry-config behövs där).
#
# Pull:a på Pi5 med localhost:5000/archivum:latest (t.ex. i dockge-stacken).
# rebuild trigger: 2 (previous run was interrupted by a host overload)
on:
push:
branches: [main, master]
paths:
- "backend/**"
- "frontend/**"
- "docker/**"
- ".gitea/workflows/build.yaml"
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build & push image
# The runner builds on the Pi5 next to live services. BUILD_CPUS caps the
# CPU-heavy build tools (Go compiler + esbuild) to 2 of 4 cores so the box
# stays responsive; nice/ionice further deprioritise the client-side work.
# Slower build, but nginx/NPM and the other containers keep serving.
run: |
nice -n 19 ionice -c 3 docker build --progress=plain \
--build-arg BUILD_CPUS=2 \
-f docker/Dockerfile \
-t localhost:5000/archivum:latest \
-t "localhost:5000/archivum:${GITHUB_SHA::12}" \
.
docker push localhost:5000/archivum:latest
docker push "localhost:5000/archivum:${GITHUB_SHA::12}"