Persist three Docker volumes into the build job (android-sdk, gradle home, npm cache) and enable the Gradle build cache, so repeat builds skip the ~2GB NDK download, Maven dependency resolution, and unchanged native/Kotlin compilation — cutting builds from ~1h to a few minutes after the first run. The runner must whitelist these volumes via config.yaml (container.valid_volumes); deploy-runner.sh now writes that config, pre-creates the volumes, and starts the daemon with --config. Requires re-running deploy-runner.sh on the runner host before the next tag. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
37 lines
1.5 KiB
YAML
37 lines
1.5 KiB
YAML
services:
|
|
runner:
|
|
image: code.forgejo.org/forgejo/runner:6.3.1
|
|
container_name: camptickets-runner
|
|
restart: unless-stopped
|
|
working_dir: /data
|
|
# Grant access to the host Docker socket group so the (uid 1000) runner can
|
|
# talk to the daemon. Set DOCKER_GID in runner/.env to your host's
|
|
# `stat -c %g /var/run/docker.sock` if it differs.
|
|
group_add:
|
|
- "${DOCKER_GID:-988}"
|
|
volumes:
|
|
- ./data:/data
|
|
# config.yaml allows the build workflow to mount the persistent cache
|
|
# volumes (valid_volumes); without it those mounts are rejected.
|
|
- ./config.yaml:/data/config.yaml:ro
|
|
# Runner spawns job containers via the host Docker daemon.
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
env_file: .env
|
|
environment:
|
|
RUNNER_NAME: ${RUNNER_NAME:-camptickets-runner}
|
|
# Register on first boot (when no .runner config exists yet), then run the
|
|
# daemon. The `docker` label maps to the node:22-bookworm job image the
|
|
# build-apk workflow expects (it installs the Android SDK itself).
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
if [ ! -f /data/.runner ]; then
|
|
echo "Registering runner with git.mowden.top ..."
|
|
forgejo-runner register --no-interactive \
|
|
--instance https://git.mowden.top \
|
|
--token "${REGISTRATION_TOKEN}" \
|
|
--name "${RUNNER_NAME:-camptickets-runner}" \
|
|
--labels "docker:docker://node:22-bookworm"
|
|
fi
|
|
exec forgejo-runner daemon --config /data/config.yaml
|