fix(docker): correct server.js path for monorepo standalone output
All checks were successful
Deploy — Staging / Lint, Typecheck & Test (push) Successful in 2m41s
Deploy — Staging / Build & push — admin (push) Successful in 3m4s
Deploy — Staging / Build & push — storefront (push) Successful in 3m16s
Deploy — Staging / Deploy to staging VPS (push) Successful in 31s

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 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 12:10:39 +03:00
parent 0da06b965d
commit 9ede637f39
2 changed files with 5 additions and 4 deletions

View File

@@ -61,4 +61,4 @@ USER nextjs
EXPOSE 3001 EXPOSE 3001
CMD ["node", "server.js"] CMD ["node", "apps/admin/server.js"]

View File

@@ -65,8 +65,9 @@ ENV NODE_ENV=production \
# Non-root user for security # Non-root user for security
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001 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 # outputFileTracingRoot is set to the repo root, so the standalone directory mirrors
# Static files and public/ must be copied separately — they are not in standalone/ # 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/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/.next/static ./apps/storefront/.next/static
COPY --from=builder --chown=nextjs:nodejs /app/apps/storefront/public ./apps/storefront/public COPY --from=builder --chown=nextjs:nodejs /app/apps/storefront/public ./apps/storefront/public
@@ -75,4 +76,4 @@ USER nextjs
EXPOSE 3000 EXPOSE 3000
CMD ["node", "server.js"] CMD ["node", "apps/storefront/server.js"]