Files
platform-core/infrastructure/ci/gitea-runner/gitea-runner-prune.service
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

18 lines
819 B
Desktop File

# Weekly cleanup of the Docker daemon inside the gitea-runner container.
# Installed by infrastructure/ci/gitea-runner/README.md ("디스크와 정리").
[Unit]
Description=Prune old images and build cache in the Gitea runner Docker
Requires=docker.service
After=docker.service
[Service]
Type=oneshot
# The docker group is enough for docker exec. No root needed at run time.
User=donghyeon
Group=docker
# image prune keeps images used by a running job container; until= filters
# on image creation time, so the pinned job image is pulled again after a week.
ExecStart=/usr/bin/docker exec gitea-runner docker image prune --all --force --filter until=168h
ExecStart=/usr/bin/docker exec gitea-runner docker builder prune --all --force --filter until=72h
ExecStartPost=/usr/bin/docker exec gitea-runner docker system df