# Step 1: Build the React app FROM node:18 as build WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build # Step 2: Serve the static files with Nginx FROM nginx:alpine # Copy React build COPY --from=build /app/dist /usr/share/nginx/html # (if CRA, replace dist with build) # Override full nginx.conf COPY nginx.conf /etc/nginx/nginx.conf # Ensure writable dirs RUN mkdir -p /tmp/nginx /var/cache/nginx && \ chmod -R 777 /tmp/nginx /var/cache/nginx EXPOSE 7860 CMD ["nginx", "-g", "daemon off;"]