# Stage 1: Build Angular application FROM node:20-alpine AS builder WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --legacy-peer-deps # Copy source code COPY . . # Build Angular app for production RUN npm run build -- --configuration production # Stage 2: Serve with Nginx FROM nginx:alpine # Copy custom nginx configuration COPY nginx.conf /etc/nginx/nginx.conf # Copy built application from builder stage (from browser subdirectory) COPY --from=builder /app/dist/goa-gel-frontend/browser /usr/share/nginx/html # Expose port 80 EXPOSE 80 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1 # Start nginx CMD ["nginx", "-g", "daemon off;"]