# Stage 1: Build the Angular application FROM node:latest AS build-prod # Set working directory in the container WORKDIR /app # Copy package.json and package-lock.json files for dependency installation COPY package*.json ./ # Install specific version of Angular CLI globally RUN npm install -g @angular/cli # Install project dependencies RUN npm ci # Copy the rest of the application files COPY . . # Build the Angular application for production RUN npm run build # Stage 2: Serve the app with Nginx FROM nginx:latest # Copy custom Nginx configuration file COPY ./nginx.conf /etc/nginx/conf.d/default.conf # Copy the built Angular application to Nginx's default directory COPY --from=build-prod /app/dist/rc-portfolio/browser /usr/share/nginx/html # Expose port 80 to allow access to the app EXPOSE 80 # Start Nginx to serve the app CMD ["nginx", "-g", "daemon off;"]