chore(deploy): containerize server deployment

This commit is contained in:
2026-07-06 11:31:55 +08:00
parent 473f6a3726
commit 6014ac845d
6 changed files with 285 additions and 165 deletions
+4 -5
View File
@@ -7,13 +7,12 @@ import { withSerwist } from "@serwist/turbopack";
* 标记根 layout 不参与静态预渲染(global-error 会在请求时渲染)
* https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
*
* 默认部署模型:`.next/` + `public/` + `next start`(或 Vercel 零配置)
* - `pnpm build` 产出 .next/(含 build manifest / chunks / 路由表 / 静态预渲染)
* - 脚本侧:scripts/deploy/_deploy_lib.sh 同步 .next/ + public/
* - 服务器启动:`cd <path> && next start -H 0.0.0.0 -p 3000`
* 或用 PM2`pm2 start "next start" --name cozsweet`
* 容器化部署模型:`output: "standalone"` + Docker Compose。
* - `pnpm build` 产出 .next/standalone、.next/static、public。
* - Dockerfile 运行 `node server.js`,不再依赖 `next start` 和完整 node_modules。
*/
const nextConfig: NextConfig = {
output: "standalone",
experimental: {
// 关闭静态优化以规避 16.2.7 global-error prerender bug
staticGenerationRetryCount: 0,