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