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.
This commit is contained in:
2026-05-02 05:38:03 +08:00
parent 2cabe7e4fd
commit 5d936832da
12 changed files with 269 additions and 8 deletions

View File

@@ -123,6 +123,8 @@ npm run test:e2e
├── playwright.config.ts # Playwright E2E 配置,启动/复用 3001 前端和 3100 测试 API
├── tsconfig.json # TypeScript 配置
├── index.html # Vite HTML 入口
├── scripts/
│ └── docker-api-entrypoint.sh # API 容器启动时执行迁移、seed 和服务启动
├── e2e/
│ ├── helpers.ts # E2E 真实 API 登录和造数工具
│ ├── audit-and-route-guards.spec.ts
@@ -218,6 +220,7 @@ npm run test:e2e
│ ├── features.md
│ ├── testing.md
│ ├── data-storage.md
│ ├── docker.md
│ ├── deployment.md
│ ├── security.md
│ ├── progress.md
@@ -309,6 +312,8 @@ npm run test:e2e
API 默认 JSON/urlencoded 请求体上限为 `100mb`,由 `API_BODY_LIMIT` 控制Nginx 同步配置了 `client_max_body_size 100m`,用于承载迁移期报告 HTML、图片/关键帧和通用文件 Data URL 上传。
Docker API 容器通过 `scripts/docker-api-entrypoint.sh` 启动,默认先执行 `prisma migrate deploy``prisma db seed`,再启动 NestJS。可用 `RUN_DB_MIGRATIONS=false``RUN_DB_SEED=false` 关闭自动初始化;完整说明见 `docs/docker.md`
Docker 前端默认暴露 `http://localhost:4002`,并额外暴露自签名 HTTPS 演示入口 `https://localhost:4443`。浏览器麦克风 API 不能在普通局域网 HTTP 页面中由应用代码强行开启;语音听写演示优先使用 HTTPS 入口,或用 Chrome/Edge 的 `--unsafely-treat-insecure-origin-as-secure` 临时标记 HTTP 来源。
### `server/prisma/schema.prisma`