Update client/Dockerfile

This commit is contained in:
2025-11-22 13:44:03 +00:00
parent 6eeda7c4ba
commit 9fef690989

View File

@@ -1,29 +1,25 @@
# Étape 1 : build Angular en mode production # Étape 1 : build Angular en prod
FROM node:20 AS build FROM node:20 AS build
WORKDIR /app WORKDIR /app
# Install dépendances
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install
# Copie du code
COPY . . COPY . .
# Build Angular en prod (utilise environment.prod.ts + fileReplacements)
RUN npm run build -- --configuration production RUN npm run build -- --configuration production
# Étape 2 : image finale Nginx pour servir les fichiers statiques # Étape 2 : Nginx pour servir le build
FROM nginx:alpine FROM nginx:1.29-alpine
# Nettoyer la page par défaut Nginx # On nettoie l'html par défaut
RUN rm -rf /usr/share/nginx/html/* RUN rm -rf /usr/share/nginx/html/*
# Copie du build Angular vers Nginx # ⚠️ Important : copier le CONTENU de dist/client et pas le dossier lui-même
COPY --from=build /app/dist/client /usr/share/nginx/html COPY --from=build /app/dist/client/ /usr/share/nginx/html
# Conf Nginx custom pour SPA # (Optionnel) conf SPA perso
COPY nginx.conf /etc/nginx/conf.d/default.conf # COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]