# Étape 1 : build Angular en mode production FROM node:20 AS build WORKDIR /app # Install dépendances COPY package*.json ./ RUN npm install # Copie du code COPY . . # Build Angular en prod (utilise environment.prod.ts + fileReplacements) RUN npm run build -- --configuration production # Étape 2 : image finale Nginx pour servir les fichiers statiques FROM nginx:alpine # Nettoyer la page par défaut Nginx RUN rm -rf /usr/share/nginx/html/* # Copie du build Angular vers Nginx COPY --from=build /app/dist/client /usr/share/nginx/html # Conf Nginx custom pour SPA COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]