# Production Dockerfile for WHOOSH Frontend FROM node:18-alpine as builder WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production # Copy source code COPY . . # Build the application RUN npm run build # Production stage FROM nginx:alpine # Install curl for health checks RUN apk add --no-cache curl # Copy built application COPY --from=builder /app/dist /usr/share/nginx/html # Copy nginx configuration COPY nginx.conf /etc/nginx/nginx.conf # Set proper permissions (nginx user already exists) RUN chown -R nginx:nginx /usr/share/nginx/html && \ chown -R nginx:nginx /var/cache/nginx && \ chown -R nginx:nginx /var/log/nginx && \ chown -R nginx:nginx /etc/nginx/conf.d RUN touch /var/run/nginx.pid && \ chown -R nginx:nginx /var/run/nginx.pid # nginx.conf already configured for port 8080 # RUN sed -i 's/listen 80/listen 8080/' /etc/nginx/nginx.conf # Switch to non-root user USER nginx # Expose port EXPOSE 8080 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8080 || exit 1 # Start nginx CMD ["nginx", "-g", "daemon off;"]