From 9ede637f39d08ea61c1196cce90ec17a38b2b605 Mon Sep 17 00:00:00 2001 From: ianshaloom Date: Sun, 8 Mar 2026 12:10:39 +0300 Subject: [PATCH] fix(docker): correct server.js path for monorepo standalone output With outputFileTracingRoot set to the repo root, Next.js standalone mirrors the full monorepo directory tree inside .next/standalone/. server.js lands at apps/storefront/server.js (not at the root), so the CMD must reflect that. Co-Authored-By: Claude Sonnet 4.6 --- apps/admin/Dockerfile | 2 +- apps/storefront/Dockerfile | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/admin/Dockerfile b/apps/admin/Dockerfile index 9073a34..b0f1fc4 100644 --- a/apps/admin/Dockerfile +++ b/apps/admin/Dockerfile @@ -61,4 +61,4 @@ USER nextjs EXPOSE 3001 -CMD ["node", "server.js"] +CMD ["node", "apps/admin/server.js"] diff --git a/apps/storefront/Dockerfile b/apps/storefront/Dockerfile index 0154b4f..ae6359d 100644 --- a/apps/storefront/Dockerfile +++ b/apps/storefront/Dockerfile @@ -65,8 +65,9 @@ ENV NODE_ENV=production \ # Non-root user for security RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001 -# standalone output mirrors the monorepo tree, so server.js lands at /app/server.js -# Static files and public/ must be copied separately — they are not in standalone/ +# outputFileTracingRoot is set to the repo root, so the standalone directory mirrors +# the full monorepo tree. server.js lands at apps/storefront/server.js inside +# standalone/, not at the root. Static files and public/ must be copied separately. COPY --from=builder --chown=nextjs:nodejs /app/apps/storefront/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/apps/storefront/.next/static ./apps/storefront/.next/static COPY --from=builder --chown=nextjs:nodejs /app/apps/storefront/public ./apps/storefront/public @@ -75,4 +76,4 @@ USER nextjs EXPOSE 3000 -CMD ["node", "server.js"] +CMD ["node", "apps/storefront/server.js"]