aboutsummaryrefslogtreecommitdiff
path: root/docker-compose.yml
blob: 9e72601c5697a4b3b35ffd3e7be4f205535b3161 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
version: "3"

services:
  caddy:
    image: caddy:2.6.2-alpine
    container_name: gateway
    restart: always
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - ./etc/Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
    networks:
      - gateway

  forgejo_server:
    image: codeberg.org/forgejo/forgejo:1.20.5-0
    container_name: git
    env_file:
      - .env
    environment:
      - USER_UID=1001
      - USER_GID=1001
      - TZ=Europe/Moscow
      - USER=git
      - FORGEJO__database__DB_TYPE=postgres
      - FORGEJO__database__HOST=forgejo_db:5432
      - FORGEJO__database__NAME=${FORGEJO_DATABASE}
      - FORGEJO__database__USER=${FORGEJO_USERNAME}
      - FORGEJO__database__PASSWD=${FORGEJO_PASSWORD}
      - FORGEJO__server__DISABLE_SSH = false
      - FORGEJO__server__SSH_PORT = 22
      - FORGEJO__server__SSH_LISTEN_PORT = 22
    restart: always
    networks:
      - forgejo
      - gateway
    volumes:
      - /home/git/.ssh/:/data/git/.ssh
      - ./data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "127.0.0.1:2222:22"
    depends_on:
      - forgejo_db

  forgejo_db:
    image: postgres:13-alpine
    container_name: forgejo_db
    restart: always
    env_file:
      - .env
    environment:
      - USER_UID=1001
      - USER_GID=1001
      - TZ=Europe/Moscow
      - POSTGRES_DATABASE=${FORGEJO_DATABASE}
      - POSTGRES_USER=${FORGEJO_USERNAME}
      - POSTGRES_PASSWORD=${FORGEJO_PASSWORD}
    healthcheck:
      test: /usr/bin/pg_isready -U ${FORGEJO_USERNAME} -d ${FORGEJO_DATABASE}
      interval: 5s
      timeout: 10s
      retries: 120
    networks:
      - forgejo
    volumes:
      - forgejo_db_data:/var/lib/postgresql/data

volumes:
  caddy_data:
  forgejo_db_data:

networks:
    gateway:
    forgejo:
        external: false