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
},
}
这有帮助吗?