From 416d1a59595e4a71313f7b28f178e45e6fdb0a93 Mon Sep 17 00:00:00 2001 From: Ho Ngoc Hai Date: Thu, 30 Apr 2026 13:49:51 +0700 Subject: [PATCH] fix(web): call next binary directly instead of npx in Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hoisted node_modules layout (set in deps stage `.npmrc` with `node-linker=hoisted`) puts `next` at `/app/node_modules/next` only — `apps/web/node_modules/next` doesn't exist. The previous `cd apps/web && npx next build` failed with: Cannot find module '/app/apps/web/node_modules/next/dist/bin/next' because `npx` resolves binaries against the cwd subtree and doesn't walk up. Switching to the explicit binary path `/app/node_modules/.bin/next build` makes the build reproducible in the goodgo Docker image. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/web/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 939fe7f..258836f 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -23,7 +23,10 @@ COPY --from=deps /app/.npmrc ./ COPY --from=deps /app/node_modules ./node_modules COPY tsconfig.base.json ./ COPY apps/web/ apps/web/ -RUN cd apps/web && npx next build +# Hoisted layout: `next` binary is in /app/node_modules/.bin/next. +# Neither `npx next` nor `pnpm run build` resolve it from apps/web cwd +# because that subtree has no node_modules. Call the binary directly. +RUN cd apps/web && /app/node_modules/.bin/next build # ---- Production ---- FROM node:22-slim AS production