From de0f3f1e6664263a169d047689cc9be3da700ed2 Mon Sep 17 00:00:00 2001 From: denshooter Date: Fri, 9 Jan 2026 03:03:33 +0100 Subject: [PATCH] fix: Update Dockerfile to correctly copy Next.js 15 standalone output structure --- DOCKER_BUILD_FIX.md | 15 ++++++++------- Dockerfile | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/DOCKER_BUILD_FIX.md b/DOCKER_BUILD_FIX.md index 9d9c6d6..a36528b 100644 --- a/DOCKER_BUILD_FIX.md +++ b/DOCKER_BUILD_FIX.md @@ -59,14 +59,15 @@ ls -la .next/standalone/ #### Problem: Falsche Verzeichnisstruktur -Next.js 15 könnte eine andere Struktur haben. Prüfe: -```bash -# Nach dem Build -find .next/standalone -name "server.js" -``` +**✅ GELÖST**: Die Debug-Ausgabe zeigt, dass Next.js 15 die Struktur `.next/standalone/` direkt verwendet: +- `.next/standalone/server.js` ✅ +- `.next/standalone/.next/` ✅ +- `.next/standalone/node_modules/` ✅ +- `.next/standalone/package.json` ✅ -Falls `server.js` in `.next/standalone/app/server.js` ist, ist das Dockerfile korrekt. -Falls es in `.next/standalone/server.js` ist, muss das Dockerfile angepasst werden. +**NICHT**: `.next/standalone/app/server.js` ❌ + +Das Dockerfile wurde korrigiert, um `.next/standalone/` direkt zu kopieren. ## Debugging diff --git a/Dockerfile b/Dockerfile index c7762fc..5d47289 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,8 +70,9 @@ RUN chown nextjs:nodejs .next # Automatically leverage output traces to reduce image size # https://nextjs.org/docs/advanced-features/output-file-tracing # Copy standalone output (contains server.js and all dependencies) -# The standalone output structure is: .next/standalone/app/ -COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone/app ./ +# The standalone output structure is: .next/standalone/ (not .next/standalone/app/) +# Next.js creates: .next/standalone/server.js, .next/standalone/.next/, .next/standalone/node_modules/ +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static # Copy Prisma files