docker-compose.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. version: "3.8"
  2. # ============================================================
  3. # LambdAgent PaaS — Docker Compose 一键启动
  4. # 用法:
  5. # docker compose up # 开发模式(默认)
  6. # docker compose --profile prod up # 生产模式(含 PostgreSQL + Redis)
  7. # ============================================================
  8. services:
  9. # ── AgentPaaS API 服务 ──────────────────────────────────
  10. api:
  11. build:
  12. context: .
  13. dockerfile: Dockerfile
  14. ports:
  15. - "${AGENTPAAS_PORT:-8000}:8000"
  16. env_file:
  17. - .env
  18. environment:
  19. AGENTPAAS_DEBUG: "true"
  20. AGENTPAAS_HOST: "0.0.0.0"
  21. AGENTPAAS_PORT: "8000"
  22. volumes:
  23. - .:/app
  24. - pip-cache:/root/.cache/pip
  25. restart: unless-stopped
  26. healthcheck:
  27. test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
  28. interval: 30s
  29. timeout: 10s
  30. retries: 3
  31. start_period: 15s
  32. # ── PostgreSQL(生产模式)────────────────────────────────
  33. db:
  34. image: postgres:16-alpine
  35. profiles: ["prod"]
  36. environment:
  37. POSTGRES_DB: agentpaas
  38. POSTGRES_USER: agentpaas
  39. POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-agentpaas_dev_password}"
  40. ports:
  41. - "5432:5432"
  42. volumes:
  43. - pgdata:/var/lib/postgresql/data
  44. restart: unless-stopped
  45. healthcheck:
  46. test: ["CMD-SHELL", "pg_isready -U agentpaas"]
  47. interval: 10s
  48. timeout: 5s
  49. retries: 5
  50. # ── Redis(生产模式)────────────────────────────────────
  51. redis:
  52. image: redis:7-alpine
  53. profiles: ["prod"]
  54. ports:
  55. - "6379:6379"
  56. volumes:
  57. - redisdata:/data
  58. restart: unless-stopped
  59. healthcheck:
  60. test: ["CMD", "redis-cli", "ping"]
  61. interval: 10s
  62. timeout: 5s
  63. retries: 5
  64. volumes:
  65. pip-cache:
  66. pgdata:
  67. redisdata: