/
/
/
1
2services:
3 forgejo:
4 container_name: forgejo
5 image: {{ container_images.forgejo }}
6 restart: unless-stopped
7
8 env_file:
9 - .env
10
11 volumes:
12 # Fast local storage for data
13 - {{ forgejo_config_dir }}/data:/data
14
15 # Bulk NFS storage for repositories
16 - {{ forgejo_data_dir }}:/repos
17
18 ports:
19 - "{{ forgejo_http_port }}:3000"
20 - "{{ forgejo_ssh_port }}:22"
21
22 networks:
23 - {{ runner_docker_network }}
24
25 healthcheck:
26 test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/healthz"]
27 interval: 10s
28 timeout: 5s
29 retries: 12
30
31{% if forgejo_runner_enabled %}
32 forgejo-runner:
33 container_name: forgejo-runner
34 build:
35 context: .
36 restart: unless-stopped
37 depends_on:
38 forgejo:
39 condition: service_healthy
40 environment:
41 - TZ=${TZ}
42 - FORGEJO_RUNNER_TOKEN=${FORGEJO_RUNNER_TOKEN}
43 - FORGEJO_EXTERNAL_URL=${FORGEJO_EXTERNAL_URL}
44 volumes:
45 - /docker/forgejo/forgejo-runner-data:/data
46 - /var/run/docker.sock:/var/run/docker.sock
47 command: ["/bin/bash","-lc",
48 "until wget -qO- ${FORGEJO_EXTERNAL_URL}/api/healthz >/dev/null 2>&1; do sleep 1; done; \
49 if [ ! -f /data/.runner ]; then \
50 forgejo-runner register --no-interactive \
51 --instance ${FORGEJO_EXTERNAL_URL} \
52 --name runner-host \
53 --token ${FORGEJO_RUNNER_TOKEN} \
54 --labels 'ubuntu-latest:host'; \
55 fi; \
56 exec forgejo-runner daemon --config /data/config.yaml"
57 ]
58
59{% endif %}
60
61networks:
62 {{ runner_docker_network }}:
63 external: true
64