version: '3.8'

services:
  web:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: ai-chat-web
    ports:
      - "3000:80"
    restart: unless-stopped
    environment:
      - TZ=Asia/Shanghai
    volumes:
      # 可选：如果需要持久化nginx日志
      - ./logs:/var/log/nginx
    networks:
      - ai-chat-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ai-chat.rule=Host(`localhost`)"
      - "traefik.http.services.ai-chat.loadbalancer.server.port=80"

  # 可选：如果需要反向代理
  nginx-proxy:
    image: nginx:alpine
    container_name: ai-chat-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./proxy.conf:/etc/nginx/conf.d/default.conf
      - ./ssl:/etc/nginx/ssl  # SSL证书目录（如果需要HTTPS）
    depends_on:
      - web
    restart: unless-stopped
    networks:
      - ai-chat-network
    profiles:
      - proxy  # 使用profile控制是否启动代理

networks:
  ai-chat-network:
    driver: bridge

volumes:
  logs:
    driver: local
