Files
Mdeical_Sur_Report/docker-compose.yaml
admin 5d936832da Complete Docker compose deployment setup
- Add an API container entrypoint that waits for PostgreSQL, runs Prisma migrations, seeds demo data, and then starts NestJS.

- Keep Prisma CLI and seed dependencies available in the API runtime image and copy seed source dependencies into the container.

- Add Docker Compose healthchecks and health-based startup ordering for PostgreSQL, API, and Nginx web services.

- Add Docker initialization environment switches for migrations, seed, and startup retries.

- Add a dedicated Docker deployment guide covering services, ports, initialization, HTTPS, production variables, backup, restore, and troubleshooting.

- Update README, AGENTS, installation, deployment, progress, and environment example docs for the Dockerized workflow.
2026-05-02 05:38:03 +08:00

71 lines
1.8 KiB
YAML

services:
db:
image: postgres:16-alpine
container_name: tuwen_db
restart: unless-stopped
environment:
POSTGRES_DB: surclaw
POSTGRES_USER: surclaw
POSTGRES_PASSWORD: surclaw_dev_password
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U surclaw -d surclaw"]
interval: 10s
timeout: 5s
retries: 10
api:
build:
context: .
dockerfile: Dockerfile.server
container_name: tuwen_api
restart: unless-stopped
environment:
API_PORT: 3100
API_BODY_LIMIT: 100mb
CORS_ORIGIN: http://localhost:4002,https://localhost:4443,http://localhost:3001
DATABASE_URL: postgresql://surclaw:surclaw_dev_password@db:5432/surclaw?schema=public
SESSION_SECRET: change-me-in-production
SESSION_COOKIE_SECURE: "false"
FILE_STORAGE_DIR: /app/uploads
RUN_DB_MIGRATIONS: "true"
RUN_DB_SEED: "true"
ports:
- "3002:3100"
depends_on:
db:
condition: service_healthy
volumes:
- uploads_data:/app/uploads
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://localhost:3100/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 10s
timeout: 5s
retries: 12
start_period: 20s
web:
build:
context: .
dockerfile: Dockerfile
container_name: tuwen_web
restart: unless-stopped
ports:
- "4002:80"
- "4443:443"
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://127.0.0.1/ || exit 1"]
interval: 10s
timeout: 5s
retries: 6
volumes:
postgres_data:
uploads_data: