Dockerfile 954 B

12345678910111213141516171819202122232425262728293031323334
  1. # ==========================
  2. # 1. BUILD ANGULAR SSR
  3. # ==========================
  4. FROM node:14-alpine AS builder
  5. WORKDIR /app
  6. # Installer les dépendances Angular
  7. COPY angular-client/package*.json ./angular-client/
  8. RUN cd angular-client && npm install
  9. # Copier le code source Angular et builder l'app SSR
  10. COPY angular-client ./angular-client
  11. RUN cd angular-client && npm run build:ssr
  12. # ==========================
  13. # 2. IMAGE DE PRODUCTION SSR
  14. # ==========================
  15. FROM node:14-alpine
  16. WORKDIR /app
  17. # Installer les outils de build nécessaires (si modules natifs)
  18. #RUN apk add --no-cache make gcc g++ python3
  19. # Copier package.json pour installer les dépendances du serveur SSR
  20. COPY angular-client/package*.json ./
  21. # Copier le build SSR généré
  22. COPY --from=builder /app/angular-client/dist/fatboar ./dist/fatboar
  23. # Installer les dépendances de production
  24. RUN npm install --omit=dev
  25. EXPOSE 4000
  26. CMD ["node", "dist/fatboar/server/main.js"]