selfhost/git/docker-compose.yaml

99 lines
2.6 KiB
YAML
Raw Normal View History

2023-02-23 11:28:01 +01:00
services:
forgejo:
2023-04-17 11:55:22 +02:00
image: codeberg.org/forgejo/forgejo:${FORGEJO_VERSION}
2023-02-23 11:28:01 +01:00
volumes:
- ${STORAGE_PATH}/forgejo_data:/data
2023-02-23 11:28:01 +01:00
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "2222:22"
networks:
- web
- git
depends_on:
- db
restart: unless-stopped
environment:
- USER_UID=1000
- USER_GID=1000
- DB_TYPE=mysql
- DB_TYPE=postgres
- DB_HOST=db:5432
- DB_NAME=${POSTGRES_DB}
- DB_USER=${POSTGRES_USER}
- DB_PASSWD=${POSTGRES_PASSWORD}
2023-06-09 08:58:54 +02:00
healthcheck:
test: ["CMD", "curl" ,"--fail", "localhost:3000/api/healthz"]
interval: 5s
timeout: 3s
labels:
- "traefik.enable=true"
2024-10-24 15:46:51 +02:00
- "traefik.http.routers.forgejo.rule=Host(`${FQDN_GIT}`, `${FQDN_GIT_OLD}`)"
2023-06-09 08:58:54 +02:00
- "traefik.http.routers.forgejo.entrypoints=websecure"
- "traefik.http.routers.forgejo.tls.certresolver=netcup"
- "traefik.http.routers.forgejo.tls.options=intermediate@file"
- "traefik.http.routers.forgejo.middlewares=gitearedir"
2024-10-24 15:46:51 +02:00
- "traefik.http.middlewares.gitearedir.redirectregex.regex=^https://${FQDN_GIT_OLD}/(.*)"
- "traefik.http.middlewares.gitearedir.redirectregex.replacement=https://${FQDN_GIT}/$${1}"
2023-06-09 08:58:54 +02:00
- "traefik.http.middlewares.gitearedir.redirectregex.permanent=true"
- "traefik.http.services.forgejo.loadbalancer.server.port=3000"
- "docker.group=git"
2023-02-23 11:28:01 +01:00
db:
2024-10-07 11:00:39 +02:00
image: postgres:${POSTGRES_VERSION}
2023-02-23 11:28:01 +01:00
restart: unless-stopped
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
networks:
- git
volumes:
- ${STORAGE_PATH}/forgejo_db:/var/lib/postgresql/data
2023-06-09 08:58:54 +02:00
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 10s
timeout: 5s
2023-02-23 11:28:01 +01:00
labels:
- "docker.group=git"
2024-10-02 15:44:08 +02:00
docker-in-docker:
image: docker:dind
privileged: 'true'
command: ['dockerd', '-H', 'tcp://0.0.0.0:2375', '--tls=false']
restart: 'unless-stopped'
networks:
- runner
runner:
image: code.forgejo.org/forgejo/runner:3.5.1
links:
- docker-in-docker
depends_on:
docker-in-docker:
condition: service_started
environment:
DOCKER_HOST: tcp://docker-in-docker:2375
user: 1002:1002
volumes:
- /var/dockervolumes/git/runner:/data
restart: 'unless-stopped'
# command: '/bin/sh -c "while : ; do sleep 1 ; done ;"' # for registration
command: '/bin/sh -c "sleep 5; forgejo-runner daemon"'
networks:
- git
- runner
2023-02-23 11:28:01 +01:00
networks:
git:
web:
external: true
2024-10-02 15:44:08 +02:00
runner:
2023-02-23 11:28:01 +01:00