fix: ensure Next.js build completes successfully in Dockerfile

- Remove build error tolerance that was hiding failures
- Add explicit check that .next directory exists after build
- Force build to fail if .next is not created

This ensures the Docker image always contains a valid Next.js build.
This commit is contained in:
soufiane 2025-11-24 01:13:38 +01:00
parent 0605e6a1ae
commit 44e2952fa1

View File

@ -17,8 +17,10 @@ ENV NEXT_PUBLIC_FACEBOOK_APP_ID=$NEXT_PUBLIC_FACEBOOK_APP_ID
COPY package*.json ./ COPY package*.json ./
RUN npm ci RUN npm ci
COPY . . COPY . .
# Build avec tolérance pour les erreurs SSR (pages client-side only) # Build Next.js - doit réussir pour continuer
RUN npm run build || (test -d .next && echo "Build completed with SSR warnings (expected for client-only pages)" || exit 1) RUN npm run build
# Vérifier que .next existe
RUN test -d .next || (echo "ERROR: .next directory not found after build!" && exit 1)
# Étape 2 : Exécution # Étape 2 : Exécution
FROM node:20-alpine AS runner FROM node:20-alpine AS runner