

networks:
  docker-shared-network:
    external: true
    name: docker-shared-network


services:
  gitea:
    image: gitea/gitea:latest
    container_name: gitea_simple
    restart: always
    # 注释掉或删除 ports 映射，不直接暴露3000端口到宿主机
    # ports:
    #   - "3000:3000"
    environment:
      - USER_UID=1000
      - USER_GID=1000
      # 关键：ROOT_URL 必须设置为用户最终访问的完整地址
      - GITEA__server__ROOT_URL=https://fy93.cn/git/
      # 协议改为 http，因为SSL将由前端的Apache2终止
      - GITEA__server__PROTOCOL=http
      - GITEA__server__HTTP_ADDR=0.0.0.0
      - GITEA__server__HTTP_PORT=3000
      - GITEA__database__DB_TYPE=sqlite3
      - GITEA__repository__SIZE_LIMIT=0           # 👈 允许无限大的仓库
      - GITEA__attachment__MAX_SIZE=999999          # 👈 允许 2GB 附件
      - GITEA__service__DISABLE_REGISTRATION=true
      - GITEA__migrations__ALLOWED_DOMAINS=note-server.work,192.168.191.201
    volumes:
      - ./gitea_data:/data
    networks:
      - docker-shared-network
