feat: Next.js 部署形态切换: standalone Dockerfile + .dockerignore
- next.config.ts 开启 output: standalone, 构建产物 .next/standalone 自带 精简 node_modules 与 server.js(替换原 Nuxt .output 形态) - Dockerfile: 两阶段构建(DaoCloud node:22-slim + pnpm npmmirror), 运行时仅拷 standalone 产物 + static + public, 非 root 用户, ENV HOSTNAME=0.0.0.0 PORT=3000, CMD node server.js - .dockerignore: 排除 node_modules/.next/haoqi_clone/.workbuddy 等, 控制构建上下文体积
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
// Docker 部署:构建产物自带精简 node_modules,运行 `node server.js` 即可
|
||||
// (产物 .next/standalone + .next/static,见 Dockerfile)
|
||||
output: "standalone",
|
||||
// Next 16 blocks dev resources from "cross-origin" hosts like 127.0.0.1 by default.
|
||||
allowedDevOrigins: ["127.0.0.1", "localhost"],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user