# Stage 1: Build Angular application FROM node:20-alpine AS build WORKDIR /app # Copy package files and install dependencies COPY package*.json ./ RUN npm install --legacy-peer-deps # Copy application source code COPY . . # Build production bundle RUN npm run build -- --configuration production # Stage 2: Serve application with Nginx FROM nginx:alpine # Copy custom nginx configuration for SPA routing COPY nginx.conf /etc/nginx/conf.d/default.conf # Copy built artifacts from stage 1 COPY --from=build /app/dist/mediagen/browser /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]