feat: 完成 Docker Compose 配置 (TASK-005)

- 创建 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>
This commit is contained in:
freedakgmail
2026-07-06 22:16:25 +08:00
parent 3ae54fe530
commit 0bb120ff6b
6 changed files with 153 additions and 9 deletions
+32 -1
View File
@@ -1,7 +1,8 @@
version: '3.8'
services:
postgres:
image: postgres:15-alpine
container_name: s2f-postgres
environment:
POSTGRES_DB: s2f_db
POSTGRES_USER: s2f_user
@@ -15,6 +16,36 @@ services:
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: