forgejo-conf-files/docker-compose.yml
2024-04-23 23:59:27 +03:00

67 lines
1.8 KiB
YAML

# Copyright 2023 The Forgejo Authors.
# SPDX-License-Identifier: MIT
version: "3"
services:
docker-in-docker:
image: docker:dind
container_name: runner-docker
privileged: true
command: [ "dockerd", "-H", "tcp://0.0.0.0:2375", "--tls=false" ]
forgejo:
image: codeberg.org/forgejo/forgejo:7
container_name: forgejo
command: >-
bash -c '
/bin/s6-svscan /etc/s6 &
sleep 10 ;
su -c "forgejo forgejo-cli actions register --secret {SHARED_SECRET} --labels debian:lxc://debian:bullseye --version 3.3.0" git ;
sleep infinity
'
environment:
- USER_UID=1000
- USER_GID=1000
- FORGEJO_WORK_DIR=/data/forgejo
- FORGEJO_CUSTOM=/data/forgejo
volumes:
- ./forgejo:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- 8080:3000
runner-register:
image: code.forgejo.org/forgejo/runner:3.3.0
container_name: runner-register
links:
- docker-in-docker
- forgejo
environment:
DOCKER_HOST: tcp://docker-in-docker:2375
volumes:
- ./forgejo-runner:/data
command: >-
bash -ec '
while : ; do
forgejo-runner create-runner-file --connect --instance http://forgejo:3000 --name runner --secret {SHARED_SECRET} && break ;
sleep 1 ;
done ;
chown -R 1000:1000 /data
'
runner-daemon:
image: code.forgejo.org/forgejo/runner:3.3.0
container_name: runner-daemon
links:
- docker-in-docker
- forgejo
environment:
DOCKER_HOST: tcp://docker-in-docker:2375
depends_on:
runner-register:
condition: service_completed_successfully
volumes:
- ./forgejo-runner:/data
command: "forgejo-runner --config config.yml daemon"