删除不再使用的 Docker 相关文件,包括 Dockerfile、docker-compose.yml 和 .dockerignore,简化项目结构以提升可维护性。同时,更新 DEPLOYMENT.md 文档,调整 Next.js 配置说明,确保与新部署方式一致。

This commit is contained in:
乘风
2026-02-05 16:58:01 +08:00
parent d83f3d8419
commit 19d0e625db
35 changed files with 368 additions and 5146 deletions

View File

@@ -0,0 +1,51 @@
#!/usr/bin/env node
/**
* 构建前清理 .next/standalone避免 Next.js build 时 EBUSY目录被占用
* 若曾运行 pnpm start请先 Ctrl+C 停掉再 build
*/
const fs = require('fs');
const path = require('path');
const rootDir = path.join(__dirname, '..');
const standaloneDir = path.join(rootDir, '.next', 'standalone');
const RETRIES = 5;
const DELAY_MS = 2000;
function sleep(ms) {
return new Promise((r) => setTimeout(r, ms));
}
async function main() {
if (!fs.existsSync(standaloneDir)) {
return;
}
for (let attempt = 1; attempt <= RETRIES; attempt++) {
try {
fs.rmSync(standaloneDir, { recursive: true, force: true, maxRetries: 3 });
console.log('[clean-standalone] 已删除 .next/standalone');
return;
} catch (e) {
if (e.code === 'EBUSY' || e.code === 'EPERM' || e.code === 'ENOTEMPTY') {
if (attempt < RETRIES) {
console.warn('[clean-standalone] 目录被占用,%ds 后重试 (%d/%d)...', DELAY_MS / 1000, attempt, RETRIES);
await sleep(DELAY_MS);
} else {
console.error('[clean-standalone] 无法删除 .next/standalone目录被占用');
console.error(' 请先关闭pnpm start、或占用该目录的其它程序如资源管理器、杀毒');
console.error(' 然后重新执行pnpm build');
process.exit(1);
}
} else {
throw e;
}
}
}
}
main().catch((e) => {
console.error(e);
process.exit(1);
});