# servir une application angular buildée # qui utilise la lib sae Aero # - relier la lib my_workspace # - build de l'app angular # - servir le build # Use official Node.js LTS image FROM node:24-alpine AS build # Set working directory WORKDIR /usr/src/app # Create a non-root user RUN addgroup -S appgroup && adduser -S appuser -G appgroup # Copy package.json and package-lock.json as root and install dependencies COPY package*.json ./ # Copy app source and fix ownership COPY . . RUN chown -R appuser:appgroup /usr/src/app RUN pwd RUN cd /usr/src/app/my-workspace/projects/sae-lib RUN npm link # Switch to non-root user USER appuser RUN pwd RUN cd ../../../../../ RUN npm link sae-lib RUN npm install RUN npm run build RUN echo "building done" # Add healthcheck (tries every 30s, times out after 10s, fails after 3 retries) # HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ # CMD wget -qO- http://localhost:8080/ || exit 1 # ============================ # 🚀 Stage 2 — Serve with NGINX # ============================ FROM nginx:1.29-alpine AS serve # Remove default NGINX website RUN rm -rf /usr/share/nginx/html/* # Copy built Angular app from previous stage COPY --from=build /app/dist/implem /usr/share/nginx/html # Expose port 80 EXPOSE 80 # Start NGINX CMD ["nginx", "-g", "daemon off;"]