0bb120ff6b
- 创建 docker-compose.yml 定义三服务架构 - 创建 backend/Dockerfile (Python 3.12) - 创建 frontend/Dockerfile (Node 20) - 创建 .dockerignore 文件 - 验证配置语法正确 - 配置 healthcheck 和服务依赖 服务: - postgres: PostgreSQL 15 - backend: FastAPI + uvicorn - frontend: Next.js dev server 任务状态:TASK-005 已完成 下一步:TASK-006 后端核心配置 Assisted-by: Kiro AI <kiro@cursor.com>
51 lines
1.2 KiB
YAML
51 lines
1.2 KiB
YAML
version: '3.8'
|
||
|
||
services:
|
||
postgres:
|
||
image: postgres:15-alpine
|
||
environment:
|
||
POSTGRES_DB: s2f_db
|
||
POSTGRES_USER: s2f_user
|
||
POSTGRES_PASSWORD: s2f_password
|
||
ports:
|
||
- "5432:5432"
|
||
volumes:
|
||
- postgres_data:/var/lib/postgresql/data
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "pg_isready -U s2f_user -d s2f_db"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
backend:
|
||
build: ./backend
|
||
environment:
|
||
DATABASE_URL: postgresql+asyncpg://s2f_user:s2f_password@postgres:5432/s2f_db
|
||
ALLOWED_ORIGINS: '["http://localhost:3000"]'
|
||
DEBUG: "true"
|
||
ports:
|
||
- "8000:8000"
|
||
volumes:
|
||
- ./backend:/app
|
||
- ./backend/uploads:/app/uploads
|
||
depends_on:
|
||
postgres:
|
||
condition: service_healthy
|
||
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||
|
||
frontend:
|
||
build: ./frontend
|
||
environment:
|
||
NEXT_PUBLIC_API_URL: http://localhost:8000
|
||
NEXT_PUBLIC_APP_NAME: "财务 AI 助手(薪财通 AI)"
|
||
ports:
|
||
- "3000:3000"
|
||
volumes:
|
||
- ./frontend:/app
|
||
- /app/node_modules
|
||
- /app/.next
|
||
depends_on:
|
||
- backend
|
||
|
||
volumes:
|
||
postgres_data: |