The template repositories need a real runner for their CI, and the owner chose one container on the desktop host (the k3s node). Add compose.yaml and config.yaml for the official Gitea Runner 5.4.1 dind image, pinned by index digest, plus the operating guide. The runner has capacity 1, one ubuntu-latest label pinned to runner-images ubuntu-24.04-v26.11.03 by digest, restart: always, and a 6 CPU / 10g cap (no more than half of the 12 cores and 31GiB). Jobs use the dind daemon through the runner's Docker proxy for Testcontainers; the host Docker socket is never mounted, job containers stay unprivileged, valid_volumes is empty, and sweep removes what a job created. Dropped alternatives: the deprecated gitea/act_runner 0.6.1 (moved to gitea/runner), the basic image with the host docker.sock (jobs would own the host daemon), and dind-rootless (Testcontainers compatibility needs separate checks). Risk: the runner container is privileged; a job can still start a privileged container on the inner daemon, so only trusted repository workflows should run here. Runner jobs do not take the desktop's heavy-work lock; the CPU and memory caps are the only guard. Verification: config keys checked with `gitea-runner config get`, `docker compose config` passes, the runner registered at user scope and the Gitea API shows desktop-runner online and idle; it came back online after `docker restart` without registering again.
41 lines
1.4 KiB
YAML
41 lines
1.4 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
|
|
- ./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:
|