From 1a9b3614203213bb92b716ec87ffb4f2a338de8a Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 7 Sep 2026 11:39:29 +0200 Subject: [PATCH] fix(docker): inject real commit id into build via NEXT_DEPLOYMENT_ID next.config.ts falls back to `git rev-parse HEAD`, but the build context has no .git (excluded by .dockerignore), so every CI build printed fatal git errors and stamped the release as "unknown". Pass the deploy commit sha as a NEXT_DEPLOYMENT_ID build-arg so git is never invoked and the actual commit reaches NEXT_PUBLIC_CMS_RELEASE and deploymentId. --- Dockerfile | 4 ++++ scripts/ci-deploy.sh | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2d773a45..4c9139a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,10 @@ FROM node:alpine AS builder WORKDIR /app ENV NEXT_TELEMETRY_DISABLED=1 +# Real release id supplied by CI (ci-deploy.sh) so next.config.ts skips git +# entirely (there is no .git in the build context). Defaults to "unknown". +ARG NEXT_DEPLOYMENT_ID="unknown" +ENV NEXT_DEPLOYMENT_ID="$NEXT_DEPLOYMENT_ID" # pnpm install is always pinned to the version in package.json's # `packageManager` field (pnpm auto-selects it on install), so this global # install only needs to exist as a bootstrap and follows the active major. diff --git a/scripts/ci-deploy.sh b/scripts/ci-deploy.sh index f2800063..9830330e 100644 --- a/scripts/ci-deploy.sh +++ b/scripts/ci-deploy.sh @@ -74,7 +74,8 @@ pnpm install --frozen-lockfile pnpm exec playwright install chromium echo "Building $image" -DOCKER_BUILDKIT=1 docker build --network=host --progress=plain --cache-from epicnext-cms:latest -t "$image" . +DOCKER_BUILDKIT=1 docker build --network=host --progress=plain --cache-from epicnext-cms:latest \ + --build-arg NEXT_DEPLOYMENT_ID="$sha" -t "$image" . check_current pnpm db:migrate check_current