84 lines
2.4 KiB
YAML
84 lines
2.4 KiB
YAML
# ============================================================
|
|
# 生产流转管理系统 — 全栈 Docker 热更新开发环境
|
|
# 启动: docker compose up -d --build
|
|
# 停止: docker compose down
|
|
# 日志: docker compose logs -f
|
|
# ============================================================
|
|
|
|
services:
|
|
# ============================================================
|
|
# PostgreSQL 15 + pgvector
|
|
# ============================================================
|
|
db:
|
|
image: pgvector/pgvector:pg15
|
|
container_name: track_db
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: track
|
|
POSTGRES_PASSWORD: track_prod_2026
|
|
POSTGRES_DB: track_production
|
|
ports:
|
|
- "8012:5432"
|
|
volumes:
|
|
- track_pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U track -d track_production"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# ============================================================
|
|
# FastAPI 后端 — --reload 热更新
|
|
# ============================================================
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile.dev
|
|
container_name: track_backend
|
|
restart: unless-stopped
|
|
environment:
|
|
DATABASE_URL: postgresql+asyncpg://track:track_prod_2026@db:5432/track_production
|
|
SECRET_KEY: change-me-in-production
|
|
DEBUG: "true"
|
|
CORS_ORIGINS: '["http://localhost:8010","https://localhost:8010","http://192.168.9.80:8010","https://192.168.9.80:8010","tauri://localhost"]'
|
|
MOM_DB_HOST: 172.20.0.3
|
|
MOM_DB_PORT: "5432"
|
|
ports:
|
|
- "8011:8000"
|
|
volumes:
|
|
- ./backend:/app
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
networks:
|
|
- default
|
|
- mom_net
|
|
|
|
# ============================================================
|
|
# Vite + React 前端 — HMR 热更新
|
|
# ============================================================
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile.dev
|
|
container_name: track_frontend
|
|
restart: unless-stopped
|
|
environment:
|
|
VITE_API_BASE_URL: /api/v1
|
|
ports:
|
|
- "8010:1420"
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules # 匿名卷,不覆盖容器里的 node_modules
|
|
depends_on:
|
|
- backend
|
|
|
|
networks:
|
|
mom_net:
|
|
external: true
|
|
name: inventory-backend_default
|
|
|
|
volumes:
|
|
track_pgdata:
|
|
name: track_pgdata
|