diff --git a/next.config.ts b/next.config.ts index 12cecbe..5f84223 100644 --- a/next.config.ts +++ b/next.config.ts @@ -2,6 +2,13 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { output: "standalone", + generateBuildId: () => { + if (process.env.NODE_ENV === "development") return "development server"; + if (!process.env.GIT_COMMIT) return "git commit hash is unavailable"; + const hash = process.env.GIT_COMMIT; + if (!hash || hash.trim().length == 0) return "empty git commit hash"; + return hash; + } }; export default nextConfig; diff --git a/src/Dockerfile b/src/Dockerfile index af50048..f4f5f00 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -35,6 +35,9 @@ COPY . . ENV NEXT_TELEMETRY_DISABLED=1 +ARG GIT_COMMIT +ENV GIT_COMMIT=$GIT_COMMIT + RUN \ if [ -f yarn.lock ]; then yarn run build; \ elif [ -f package-lock.json ]; then npm run build; \