# Multi-stage build for Angular frontend FROM node:24-alpine AS build # Accept npm registry as build argument ARG NPM_REGISTRY=https://registry.npmjs.org/ WORKDIR /app # Copy package files COPY frontend/package*.json ./ # Configure npm registry and regenerate package-lock.json if custom registry is provided RUN if [ "$NPM_REGISTRY" != "https://registry.npmjs.org/" ]; then \ echo "Using custom npm registry: $NPM_REGISTRY"; \ npm config set registry "$NPM_REGISTRY"; \ rm -f package-lock.json; \ npm install --package-lock-only; \ fi # Install dependencies RUN npm ci # Copy source code COPY frontend/ ./ # Build for production RUN npm run build:prod # Final stage - nginx to serve static files FROM nginx:alpine # Copy built Angular app to nginx COPY --from=build /app/dist/frontend/browser /usr/share/nginx/html # Copy nginx configuration COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]