diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 5f1d607..2916c4b 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -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 diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 6b43d7a..5e9ea69 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -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: [ {