跳到主要內容
設定next.config.jsgenerateBuildId

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
  },
}