services:
  server:
    image: codeberg.org/forgejo/forgejo:13
    container_name: forgejo
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - FORGEJO__database__DB_TYPE=postgres
      - FORGEJO__database__HOST=db:5432
      - FORGEJO__database__NAME=forgejo
      - FORGEJO__database__USER=forgejo
      - FORGEJO__database__PASSWD=SDh3y2ElQunEuH8e9Jgw2B8D
    restart: always
    networks:
      - forgejo
      - traefik
    volumes:
      - /srv/forgejo/forgejo:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
#    ports:
#      - "3000:3000"
#      - "222:22"
    depends_on:
      - db
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.forgejo.entrypoints=websecure"
      - "traefik.http.routers.forgejo.rule=Host(`forgejo.knast.cc`)"
      - "traefik.http.routers.forgejo.tls.certresolver=letsencr"
      - "traefik.http.services.forgejo.loadbalancer.server.port=3000"

  db:
    image: postgres:14
    restart: always
    environment:
      - POSTGRES_USER=forgejo
      - POSTGRES_PASSWORD=SDh3y2ElQunEuH8e9Jgw2B8D
      - POSTGRES_DB=forgejo
    networks:
      - forgejo
    volumes:
      - /srv/forgejo/postgres:/var/lib/postgresql/data

networks:
  forgejo:
    external: false
  traefik:
    external: true
