generateBuildId
Next.js 在 next build 期间生成一个 ID,用于标识正在提供哪个版本的应用程序。应使用相同的构建并启动多个容器。
如果您为环境的每个阶段重新构建,您将需要生成一个一致的构建 ID 以在容器之间使用。在 next.config.js 中使用 generateBuildId 命令
next.config.js
module.exports = {
generateBuildId: async () => {
// This could be anything, using the latest git hash
return process.env.GIT_HASH
},
}这有帮助吗?