Files
platform-core/infrastructure/ci/gitea-runner/compose.yaml
T
DongHyeonka a5f0bff26e feat(ci): cap the runner Docker and prune it weekly
The Docker daemon inside the gitea-runner container keeps every job
image and all build cache in the gitea-runner_docker volume on the
root SSD that production k3s also uses. It grew to 16G in the two days
after the runner was installed and held 12.43G of images and 8.44G of
build cache on 2026-11-11. The README only said to look once a week
and prune by hand.

Mount daemon.json into the runner so the inner BuildKit GC keeps 2GB
to 10GB of build cache, and shrinks to 2GB while the disk has less
than 35GB free. Add gitea-runner-prune.service and .timer, a host
systemd timer for Sunday 04:30 KST that removes unused images created
more than 7 days ago and build cache older than 3 days. The service
runs as donghyeon in the docker group, so it needs root only to
install. A user timer was rejected because lingering is off for
donghyeon and user units stop with the last login session.

Risk: image prune filters on image creation time, so the pinned job
image is deleted weekly and the next job pulls about 543MB again.
Recreating the runner to pick up daemon.json cancels a running job,
so it is done only while the runner is idle.

Verification: systemd-analyze verify passes for both units, and the
calendar expression's next run is Sun 2026-11-15 04:30 KST. docker
compose config passes; dockerd --validate inside the runner (Docker
29.9.3) accepts daemon.json.
2026-11-12 07:28:03 +09:00

43 lines
1.6 KiB
YAML

# Single Gitea Actions runner on the desktop host (docker compose).
# Copy this file and config.yaml to the runtime folder named in README.md
# and run `docker compose up -d` there. Do not run it from a Git checkout.
name: gitea-runner
services:
runner:
# Official Gitea Runner 5.4.1, dind flavour, pinned by index digest.
image: docker.io/gitea/runner:5.4.1-dind@sha256:8bcb489f9dd6be500de22bcaa8512ef57b81ae50315db8c7a1dc1b74978a76f4
container_name: gitea-runner
hostname: desktop-runner
# Starts again after a crash, a Docker restart and a host reboot.
restart: always
# Required by the bundled Docker daemon that runs the jobs. Jobs never
# see the host Docker socket. See README.md for what this still allows.
privileged: true
environment:
GITEA_INSTANCE_URL: https://git.learn.hyeonworks.com
GITEA_RUNNER_NAME: desktop-runner
# Read only while /data/.runner does not exist yet.
GITEA_RUNNER_REGISTRATION_TOKEN_FILE: /run/gitea-runner/registration-token
CONFIG_FILE: /config.yaml
volumes:
- ./config.yaml:/config.yaml:ro
# Caps the build cache of the inner Docker daemon. See README.md.
- ./daemon.json:/etc/docker/daemon.json:ro
- ./secrets:/run/gitea-runner:ro
- data:/data
- docker:/var/lib/docker
# Every job container runs inside this container's cgroup, so these
# limits cap all CI work on the shared desktop.
cpus: 6
mem_limit: 10g
logging:
driver: json-file
options:
max-size: 10m
max-file: "3"
volumes:
data:
docker: