# Stage 1: Build the Angular application FROM node:25-alpine AS builder # Set working directory WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production=false # Copy source code COPY . . # Build the application for production RUN npm run build # Stage 2: Production image FROM node:25-alpine AS production # Set working directory WORKDIR /app # Copy package files COPY package*.json ./ # Install only production dependencies RUN npm ci --only=production && npm cache clean --force # Copy built application from builder stage COPY --from=builder /app/dist ./dist # Set environment to production ENV NODE_ENV=production # Expose port (default Express port) EXPOSE 4000 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ CMD node -e "require('http').get('http://localhost:4000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})" # Start the application CMD ["node", "dist/vac-optimizer/server/server.mjs"]