# ========================== # 1. BUILD ANGULAR SSR # ========================== FROM node:14-alpine AS builder WORKDIR /app # Installer les dépendances Angular COPY angular-client/package*.json ./angular-client/ RUN cd angular-client && npm install # Copier le code source Angular et builder l'app SSR COPY angular-client ./angular-client RUN cd angular-client && npm run build:ssr # ========================== # 2. IMAGE DE PRODUCTION SSR # ========================== FROM node:14-alpine WORKDIR /app # Installer les outils de build nécessaires aux modules natifs si besoin #RUN apk add --no-cache make gcc g++ python3 # Copier uniquement les fichiers nécessaires du serveur SSR généré par Angular Universal COPY angular-client/package*.json ./ COPY --from=builder /app/angular-client/dist ./dist # Installer les dépendances de production RUN npm install --omit=dev # Nettoyer les outils de build pour alléger l'image #RUN apk del make gcc g++ python3 EXPOSE 4000 CMD ["node", "dist/server/main.js"]