Files
2026-06-18 09:48:05 +08:00

81 lines
2.4 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PCM 孕产个案管理平台 · 部署编排(dev/staging
# 服务:后端 API + PostgreSQL + 三个前端(孕妇/医护运营/家属,各自 nginx 托管并反代 /api → backend
# 一键:`make up`(或 `docker compose up -d --build`
#
# 后端经 DATABASE_URL 连接 db 服务并持久化(auth/audit 已落库);未设置则回退内存仓储。
services:
backend:
build: ./backend
image: pcm-backend:latest
environment:
PORT: "3000"
NODE_ENV: production
# 生产务必通过 .env 注入强随机密钥
AUTH_SECRET: "${AUTH_SECRET:-dev-secret-change-me}"
# 持久化:指向 db 服务(不设置则后端回退内存仓储)
DATABASE_URL: "postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-pcm}"
# 字段级加密密钥(32 字节 hex64/base64;生产经 KMS 注入)
FIELD_ENCRYPTION_KEY: "${FIELD_ENCRYPTION_KEY:-}"
ports:
- "${BACKEND_PORT:-3000}:3000"
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:3000/api/health"]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
restart: unless-stopped
db:
image: postgres:15-alpine
environment:
POSTGRES_USER: "${POSTGRES_USER:-postgres}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-postgres}"
POSTGRES_DB: "${POSTGRES_DB:-pcm}"
volumes:
- pcm-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-postgres} -d $${POSTGRES_DB:-pcm}"]
interval: 10s
timeout: 3s
retries: 10
start_period: 10s
restart: unless-stopped
patient-web:
build: ./patient-app
image: pcm-patient-web:latest
depends_on:
backend:
condition: service_healthy
ports:
- "${PATIENT_PORT:-8081}:80"
restart: unless-stopped
admin-web:
build: ./admin-web
image: pcm-admin-web:latest
depends_on:
backend:
condition: service_healthy
ports:
- "${ADMIN_PORT:-8082}:80"
restart: unless-stopped
family-web:
build: ./family-app
image: pcm-family-web:latest
depends_on:
backend:
condition: service_healthy
ports:
- "${FAMILY_PORT:-8083}:80"
restart: unless-stopped
volumes:
pcm-db-data: