Enable Next.js standalone mode and simplify Dockerfile copy block
All checks were successful
Staging Build / build (push) Successful in 1m43s

This commit is contained in:
DanielS
2026-06-23 00:32:08 +02:00
parent fa1edc9c12
commit 0f55e17095
2 changed files with 7 additions and 19 deletions

View File

@@ -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"]