From 0f55e170958970bda622807cf0da9d4ecf5b1f21 Mon Sep 17 00:00:00 2001 From: DanielS Date: Tue, 23 Jun 2026 00:32:08 +0200 Subject: [PATCH] Enable Next.js standalone mode and simplify Dockerfile copy block --- Dockerfile | 25 ++++++------------------- shop/next.config.ts | 1 + 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index f6135e3..5b5e2eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,28 +23,15 @@ FROM node:20-alpine AS runner WORKDIR /app -# Copy only built assets and runtime dependencies -COPY --from=builder /app/.next ./.next -# Copy standalone server and static assets -COPY --from=builder /app/.next/standalone ./ -COPY --from=builder /app/.next/static ./.next/static -# KORREKTUR: Kopiert den public-Ordner nur, wenn er wirklich existiert +# Statische Assets kopieren (wichtig für die Chunks/404-Fehler von vorhin) COPY --from=builder /app/public* ./public +COPY --from=builder /app/.next/static ./.next/static -COPY --from=builder /app/package*.json ./ -# KORREKTUR: Flexibles Kopieren der Next-Konfiguration (egal ob .js oder .mjs) -COPY --from=builder /app/next.config.* ./ -# KORREKTUR: Optionale TS-Dateien über den Sternchen-Trick absichern -COPY --from=builder /app/tsconfig.jso* ./ -COPY --from=builder /app/next-env.d.t* ./ -# Install production dependencies (already installed in builder, but ensure they are present) -RUN npm ci --omit=dev - -# Environment variables -ENV NODE_ENV=production -ENV PORT=3000 +# Den fertigen Standalone-Server kopieren +COPY --from=builder /app/.next/standalone ./ EXPOSE 3000 +ENV PORT=3000 +ENV HOSTNAME="0.0.0.0" -# Start the Next.js server (standalone) CMD ["node", "server.js"] diff --git a/shop/next.config.ts b/shop/next.config.ts index b5d0c50..d79f1fc 100644 --- a/shop/next.config.ts +++ b/shop/next.config.ts @@ -1,6 +1,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { + output: "standalone", cacheComponents: false, };