# vim: ft=yaml.docker-compose
version: "3.8"

services:
  app:
    image: codeberg.org/forgejo/forgejo:{{ services.forgejo.version }}
    restart: unless-stopped
    networks:
      - external_services
      - postfix
    volumes:
      - ".:/data"
    ports:
      - "22:22"
    environment:
      VIRTUAL_HOST: "{{ services.forgejo.domain }}"
      VIRTUAL_PORT: "3000"
      LETSENCRYPT_HOST: "{{ services.forgejo.domain }}"
      LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
      # Forgejo customization, see: https://docs.gitea.io/en-us/install-with-docker/#customization
      # https://docs.gitea.io/en-us/config-cheat-sheet/#security-security
      FORGEJO__mailer__ENABLED: true
      FORGEJO__mailer__FROM: noreply@{{ services.forgejo.domain }}
      FORGEJO__mailer__PROTOCOL: smtp
      FORGEJO__mailer__SMTP_ADDR: "{{ smtp_host }}"
      FORGEJO__mailer__SMTP_PORT: "{{ smtp_port }}"
      FORGEJO__security__LOGIN_REMEMBER_DAYS: "60"
      FORGEJO__security__PASSWORD_COMPLEXITY: off
      FORGEJO__security__MIN_PASSWORD_LENGTH: "8"
      FORGEJO__security__PASSWORD_CHECK_PWN: true
      FORGEJO__service__ENABLE_NOTIFY_MAIL: true
      FORGEJO__service__REGISTER_EMAIL_CONFIRM: true

networks:
  external_services:
    external: true
  postfix:
    external: true