fix: Web standalone — set outputFileTracingRoot to repo root
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 22s
CI / E2E Tests (push) Has been skipped
Deploy / Build AI Services Image (push) Failing after 14s
E2E Tests / Playwright E2E (push) Failing after 20s
Deploy / Build API Image (push) Failing after 19s
Deploy / Build Web Image (push) Failing after 12s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped

In monorepo, Next.js standalone creates symlinks instead of real files.
Setting outputFileTracingRoot to repo root produces self-contained output.
Dockerfile updated to copy from correct standalone structure.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ho Ngoc Hai
2026-04-14 00:19:48 +07:00
parent 3e4f681adb
commit 4418d60c2b
2 changed files with 10 additions and 4 deletions

View File

@@ -28,10 +28,14 @@ ENV HOSTNAME=0.0.0.0
ENV PORT=3000
# Copy Next.js standalone output
# In monorepo with `cd apps/web && next build`, standalone contains:
# .next/standalone/ → root with server.js + node_modules/ + package.json
RUN mkdir -p ./public
COPY --from=build --chown=node:node /app/apps/web/.next/standalone ./
# With outputFileTracingRoot=repo_root, standalone structure is:
# .next/standalone/node_modules/ → real deps (not symlinks)
# .next/standalone/apps/web/ → server.js, .next/, package.json
RUN mkdir -p ./public ./.next/static
COPY --from=build --chown=node:node /app/apps/web/.next/standalone/node_modules ./node_modules
COPY --from=build --chown=node:node /app/apps/web/.next/standalone/apps/web/server.js ./server.js
COPY --from=build --chown=node:node /app/apps/web/.next/standalone/apps/web/package.json ./package.json
COPY --from=build --chown=node:node /app/apps/web/.next/standalone/apps/web/.next ./.next
COPY --from=build --chown=node:node /app/apps/web/.next/static ./.next/static
# Copy public assets if any exist (may be empty)
COPY --from=build --chown=node:node /app/apps/web/public ./public

View File

@@ -7,6 +7,8 @@ const withNextIntl = createNextIntlPlugin('./i18n/request.ts');
const nextConfig = {
reactStrictMode: true,
output: 'standalone',
// In monorepo, trace from repo root so standalone output includes all deps
outputFileTracingRoot: require('path').join(__dirname, '../../'),
images: {
remotePatterns: [
{