version: '3.8'

services:
  infogenie-backend:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: infogenie-backend
    restart: always
    ports:
      - "2323:2323"
    volumes:
      # 持久化数据映射
      - /shumengya/docker/infogenie-backend/data:/app/data

    environment:
      # 从 .env 文件读取环境变量
      - MONGO_URI=${MONGO_URI}
      - MAIL_USERNAME=${MAIL_USERNAME}
      - MAIL_PASSWORD=${MAIL_PASSWORD}
      - SECRET_KEY=${SECRET_KEY}
      - FLASK_ENV=production
      # 生产环境配置
      - HWT_DOMAIN=.shumengya.top
      - HWT_SECURE=False  # 如果使用 HTTPS 反向代理，设为 False；直接 HTTPS 设为 True
    env_file:
      - .env
    networks:
      - infogenie-network
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost:2323/api/health || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

networks:
  infogenie-network:
    driver: bridge
