# Stage 1: Build the Angular application FROM node:alpine AS builder # Set the working directory WORKDIR / # Copy package.json and package-lock.json COPY package.json package-lock.json ./ # Install dependencies RUN npm install # Copy the rest of the application code COPY . . COPY dist dist # Build the application for production # RUN npm run build:prod # Stage 2: Serve the application with Nginx FROM nginx:latest RUN mkdir /app # Copy the built application from the builder stage to the Nginx html directory COPY --from=builder dist/angular-starter /usr/share/nginx/html COPY --from=builder dist/angular-starter /app # Copy the custom Nginx configuration file COPY config/default.conf /etc/nginx/conf.d/default.conf # COPY config/default.conf test.txt # Expose port 80 EXPOSE 80 # Start Nginx CMD ["nginx", "-g", "daemon off;"]