aboutsummaryrefslogblamecommitdiff
path: root/docker-compose.yml
blob: 9e72601c5697a4b3b35ffd3e7be4f205535b3161 (plain) (tree)















































































                                                                             
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