ng-implementation/angular-basic/Dockerfile
2025-10-17 12:13:39 +02:00

53 lines
No EOL
1.2 KiB
Docker

# --- Build stage --- ## Forcing rebuild 1
FROM node:24 AS build
WORKDIR /app
# Copier l'application Angular et la librairie locale
# On attend un contexte de build à la racine du repo pour inclure my-workspace
COPY angular-basic /app/angular-basic
COPY my-workspace /app/my-workspace
# Définir le répertoire de travail sur l'application
WORKDIR /app/angular-basic
RUN echo "============= run setup script "
RUN ./setup.sh
# Construire le projet Angular (production)
RUN npm run build
# --- Production stage ---
FROM nginx:1.27-alpine AS production
#RUN apk add --no-cache bash nano wget
# Nettoyer les fichiers nginx par défaut
RUN rm -rf /usr/share/nginx/html/*
# Copier la sortie du build (on testera le bon chemin ensuite)
#COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=build /app/angular-basic/dist/angular-basic/browser/* /usr/share/nginx/html
RUN echo "============= liste des fichiers dans nginx html"
RUN ls -l "/usr/share/nginx/html"
RUN echo "============="
# 🔹 Exposer le port par défaut d'nginx (80)
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD wget -qO- http://localhost:80/ || exit 1
RUN echo "servir le front static CSC: done."
CMD ["nginx", "-g", "daemon off;"]