services:
  db:
    image: postgres:16
    container_name: gitea-db
    restart: unless-stopped
    environment:
      POSTGRES_USER: gitea
      POSTGRES_PASSWORD: "oC^Kg66uG%^8aZ6KfSJM"
      POSTGRES_DB: gitea
    volumes:
      - gitea_db:/var/lib/postgresql/data
    networks:
      - gitea

  gitea:
    image: gitea/gitea:latest
    container_name: gitea
    restart: unless-stopped
    depends_on:
      - db
    environment:
      USER_UID: "1000"
      USER_GID: "1000"
      GITEA__database__DB_TYPE: postgres
      GITEA__database__HOST: db:5432
      GITEA__database__NAME: gitea
      GITEA__database__USER: gitea
      GITEA__database__PASSWD: "oC^Kg66uG%^8aZ6KfSJM"
      GITEA__service__DISABLE_REGISTRATION: "true"
      GITEA__service__SHOW_REGISTRATION_BUTTON: "false"
    volumes:
      - gitea_data:/data
    ports:
      - "127.0.0.1:3001:3000"
      - "2223:22"
    networks:
      - gitea

volumes:
  gitea_db:
  gitea_data:

networks:
  gitea:
    driver: bridge
