From c12351f2c99daaed710a1136eb13f6ccc54cbcff Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Thu, 9 Oct 2025 18:55:54 -0500 Subject: [PATCH] fix: correct node_modules path for pnpm symlinks in Docker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Next.js standalone build creates symlinks in node_modules that point to ../../../node_modules/.pnpm. When the working directory is /app, these resolve to /node_modules/.pnpm. Fixed by copying node_modules to /node_modules instead of /app/node_modules. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e99226a4..a1d01476 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,11 +38,16 @@ WORKDIR /app RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs -# Copy built application +# Copy built application from standalone output COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static COPY --from=builder --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public +# Copy node_modules with proper structure for pnpm symlinks +# The standalone output has symlinks that point to ../../../node_modules/.pnpm +# which resolves to /node_modules/.pnpm when CWD is /app +COPY --from=builder --chown=nextjs:nodejs /app/node_modules /node_modules + # Set up environment USER nextjs EXPOSE 3000