| 1234567891011121314151617181920212223242526272829303132 |
- # ========= ÉTAPE 1 : COMPILATION ANGULAR SSR =========
- FROM node:14-alpine AS builder
- WORKDIR /app
- # Copier les dépendances Angular et installer
- COPY angular-client/package*.json ./angular-client/
- RUN cd angular-client && npm install
- # Copier le code source et compiler l'application
- COPY angular-client ./angular-client
- RUN cd angular-client && npm run build:ssr
- # ========= ÉTAPE 2 : IMAGE FINALE =========
- FROM node:14-alpine
- WORKDIR /app
- # Installer les outils de compilation
- RUN apk add --no-cache make gcc g++ python3
- # Copier le backend Express
- COPY express-server .
- # Copier les fichiers compilés d'Angular SSR (depuis le stage builder)
- COPY --from=builder /app/angular-client/dist ./dist
- # Installer les dépendances avec nettoyage des outils
- RUN npm install --omit=dev && \
- apk del make gcc g++ python3
- # Exposition du port et commande de démarrage
- EXPOSE 4000
- CMD ["node", "index.js"]
|