Use DIND for forgejo runner

This commit is contained in:
Jake Howard 2026-04-05 22:09:11 +01:00
parent cf724a2dd9
commit 37858b5b02
No known key found for this signature in database
GPG key ID: 57AFB45680EDD477
3 changed files with 12 additions and 33 deletions

View file

@ -7,6 +7,7 @@ ignore: |
ansible/roles/traefik/files/traefik.yml
ansible/roles/forgejo_runner/files/config.yml
env
.venv
rules:
document-start: disable

View file

@ -10,7 +10,8 @@ runner:
# Execute how many tasks concurrently at the same time.
capacity: {{ ansible_processor_nproc }}
# Extra environment variables to run jobs.
envs: {}
envs:
DOCKER_HOST: tcp://dind.docker.internal:2375
# Extra environment variables to run jobs from a file.
# It will be ignored if it's empty or the file doesn't exist.
env_file: /data/.env
@ -56,7 +57,7 @@ container:
# Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
privileged: false
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
options: ""
options: '--add-host=dind.docker.internal:host-gateway'
# The parent directory of a job's working directory.
# If it's empty, /workspace will be used.
workdir_parent: /workspace
@ -73,7 +74,7 @@ container:
# If it's empty, act_runner will find an available docker host automatically.
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
docker_host: ""
docker_host: "tcp://dind:2375"
force_pull: false
host:

View file

@ -7,40 +7,17 @@ services:
- ./config.yml:/data/config.yml
environment:
- TZ={{ timezone }}
- DOCKER_HOST=tcp://docker_proxy:2375
restart: unless-stopped
command: forgejo-runner --config config.yml daemon
networks:
- default
- forgejo_private
depends_on:
- docker_proxy
- dind
ports:
- "{{ ansible_default_ipv4.address }}:4000:4000"
docker_proxy:
image: lscr.io/linuxserver/socket-proxy:latest
restart: unless-stopped
dind:
image: docker:dind
environment:
- POST=1
- CONTAINERS=1
- INFO=1
- IMAGES=1
- VOLUMES=1
- NETWORKS=1
- ALLOW_START=1
- ALLOW_STOP=1
- ALLOW_RESTARTS=1
- EXEC=1
tmpfs:
- /run
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- forgejo_private
logging:
driver: none
networks:
forgejo_private:
internal: true
- TZ={{ timezone }}
privileged: true
restart: unless-stopped
command: dockerd -H tcp://0.0.0.0:2375 --tls=false