# Stage 1: Build the Angular application FROM node:18 as build WORKDIR /app # Install dependencies first (better caching) COPY package*.json ./ RUN npm install # Copy source code COPY . . # Build for production with specific base-href RUN npm run build -- --configuration production --base-href /ocrf/ # Stage 2: Serve via Nginx FROM nginx:alpine # Remove default nginx static assets RUN rm -rf /usr/share/nginx/html/* # Create target directory (since we use /ocrf/ base-href) RUN mkdir -p /usr/share/nginx/html/ocrf # Copy built assets from builder stage # Note: Adjust 'dist/frontend/browser' based on your angular.json output path. # Angular 17+ creates 'browser' folder. COPY --from=build /app/dist/frontend/browser /usr/share/nginx/html/ocrf # Copy custom nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port 80 EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]