version: '3.8'

services:
  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile.dev
    ports:
      - "8038:3000"
    volumes:
      - ./frontend:/app
      - /app/node_modules
    environment:
      - VITE_API_URL=http://101.43.95.130:8037
    # 注意：Vite环境变量需要在构建时设置，运行时修改需要重启容器
    depends_on:
      - backend
    networks:
      - aiagent-network

  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile.dev
    ports:
      - "8037:8000"
    volumes:
      - ./backend:/app
    environment:
      - DATABASE_URL=mysql+pymysql://root:!Rjb12191@gz-cynosdbmysql-grp-d26pzce5.sql.tencentcdb.com:24936/agent_db?charset=utf8mb4
      - REDIS_URL=redis://redis:6379/0
      - SECRET_KEY=dev-secret-key-change-in-production
      - CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:8038,http://101.43.95.130:8038
      - DEEPSEEK_API_KEY=sk-fdf7cc1c73504e628ec0119b7e11b8cc
      - DEEPSEEK_BASE_URL=https://api.deepseek.com
    depends_on:
      - redis
    networks:
      - aiagent-network

  celery:
    build:
      context: ./backend
      dockerfile: Dockerfile.dev
    command: celery -A app.core.celery_app worker --loglevel=info
    volumes:
      - ./backend:/app
    environment:
      - DATABASE_URL=mysql+pymysql://root:!Rjb12191@gz-cynosdbmysql-grp-d26pzce5.sql.tencentcdb.com:24936/agent_db?charset=utf8mb4
      - REDIS_URL=redis://redis:6379/0
      - DEEPSEEK_API_KEY=sk-fdf7cc1c73504e628ec0119b7e11b8cc
      - DEEPSEEK_BASE_URL=https://api.deepseek.com
    depends_on:
      - redis
      - backend
    networks:
      - aiagent-network

  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    networks:
      - aiagent-network

volumes:
  redis_data:

networks:
  aiagent-network:
    driver: bridge
