services:
  forgejo:
    image: codeberg.org/forgejo/forgejo:9
    container_name: forgejo
    restart: unless-stopped
    depends_on:
      - db
    ports:
      - 222:22
    volumes:
      - data:/data
      - ./config/app.ini:/etc/forgejo/app.ini
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro 
    environment:
      FORGEJO__database__DB_TYPE: postgres
      FORGEJO__database__HOST: "forgejo-db"
      FORGEJO__database__NAME: forgejo
      FORGEJO__database__USER: forgejo
      FORGEJO__database__PASSWD: ${DB_PASSWORD}
  
  db:
    image: postgres:14
    container_name: forgejo-db
    restart: unless-stopped
    volumes:
      - data_db:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: forgejo
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGES_DB: forgejo

volumes:
  data:
  data_db:

networks:
  default:
    name: proxy
    external: true
