version: '3.8' services: # PostgreSQL 数据库 postgres: image: postgres:16-alpine container_name: agent-platform-postgres environment: POSTGRES_USER: agent_platform POSTGRES_PASSWORD: agent_platform_secret POSTGRES_DB: agent_platform volumes: - postgres_data:/var/lib/postgresql/data ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U agent_platform"] interval: 10s timeout: 5s retries: 5 # Redis 缓存 redis: image: redis:7-alpine container_name: agent-platform-redis volumes: - redis_data:/data ports: - "6379:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 # 后端 API 服务 backend: build: context: ./backend dockerfile: Dockerfile container_name: agent-platform-backend environment: NODE_ENV: production PORT: 3000 DATABASE_URL: postgresql://agent_platform:agent_platform_secret@postgres:5432/agent_platform?schema=public REDIS_HOST: redis REDIS_PORT: 6379 JWT_SECRET: your-super-secret-jwt-key-change-in-production JWT_EXPIRES_IN: 7d SCHEDULER_POLL_INTERVAL: 1000 SCHEDULER_MAX_CONCURRENT_TASKS: 10 ports: - "3000:3000" depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - ./backend:/app - /app/node_modules command: sh -c "npx prisma migrate deploy && npm start" # 前端应用 frontend: build: context: ./frontend dockerfile: Dockerfile container_name: agent-platform-frontend environment: VITE_API_URL: http://localhost:3000/api/v1 ports: - "80:80" depends_on: - backend volumes: postgres_data: redis_data: