删除不再使用的 Docker 相关文件,包括 Dockerfile、docker-compose.yml 和 .dockerignore,简化项目结构以提升可维护性。同时,更新 DEPLOYMENT.md 文档,调整 Next.js 配置说明,确保与新部署方式一致。
This commit is contained in:
24
scripts/write-standalone-warning.js
Normal file
24
scripts/write-standalone-warning.js
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* postbuild:在 .next/standalone 中写入提示,避免用户 cd 进去直接 node server.js 导致 404
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const standaloneDir = path.join(__dirname, '..', '.next', 'standalone');
|
||||
const msg = `不要在此目录直接运行 node server.js!
|
||||
否则 .next/static 和 public 未复制,页面会空白并报 404。
|
||||
|
||||
请在项目根目录执行:
|
||||
pnpm start
|
||||
|
||||
或:
|
||||
node scripts/start-standalone.js
|
||||
`;
|
||||
|
||||
const file = path.join(standaloneDir, '请勿直接运行.txt');
|
||||
if (fs.existsSync(standaloneDir)) {
|
||||
try {
|
||||
fs.writeFileSync(file, msg, 'utf8');
|
||||
} catch (_) {}
|
||||
}
|
||||
Reference in New Issue
Block a user