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.
This commit is contained in:
1 parent
3e0ba73d1c
commit
1a9b361420
2 files changed
+6
-1
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user