# Stage 1: Build the React application FROM node:18-alpine as builder WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build # Stage 2: Serve the application with Nginx FROM nginx:alpine # Copy the built React app from the builder stage COPY --from=builder /app/dist /usr/share/nginx/html # Copy the custom Nginx configuration file COPY nginx.conf /etc/nginx/nginx.conf # EXPOSE port 7860 to match Hugging Face Spaces' expectation EXPOSE 7860 CMD ["nginx", "-g", "daemon off;"]