# Production Dockerfile for React Frontend FROM node:18-alpine AS builder # Set working directory WORKDIR /app # Copy package files COPY package*.json ./ COPY apps/web/package*.json ./apps/web/ COPY packages/shared/package*.json ./packages/shared/ # Install dependencies RUN npm ci --only=production # Copy source code COPY apps/web/ ./apps/web/ COPY packages/shared/ ./packages/shared/ COPY turbo.json ./ # Build argument for API URL ARG VITE_API_URL=http://localhost:3333 ENV VITE_API_URL=$VITE_API_URL # Build the application RUN cd apps/web && npm run build # Production stage with nginx FROM nginx:alpine # Copy built files COPY --from=builder /app/apps/web/dist /usr/share/nginx/html # Copy nginx configuration COPY apps/web/nginx.prod.conf /etc/nginx/conf.d/default.conf # Expose port 80 EXPOSE 80 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1 CMD ["nginx", "-g", "daemon off;"]