# Dockerfile for React Frontend # Build stage FROM node:20-alpine AS builder WORKDIR /build # Copy package files COPY frontend/package*.json ./ # Install dependencies RUN npm install # Copy frontend source code COPY frontend/src ./src COPY frontend/index.html ./ COPY frontend/vite.config.js ./ # Build the frontend RUN npm run build # Production stage with nginx FROM nginx:alpine LABEL maintainer="automation-team@company.com" LABEL description="Datacenter Documentation Frontend" # Copy built assets from builder COPY --from=builder /build/dist /usr/share/nginx/html # Copy nginx configuration COPY deploy/docker/nginx.conf /etc/nginx/conf.d/default.conf # Expose port EXPOSE 80 # Health check (use curl which is available in nginx:alpine) HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://127.0.0.1/health || exit 1 # Run nginx CMD ["nginx", "-g", "daemon off;"]