# Frontend Dockerfile for HF Spaces FROM node:20-alpine AS builder WORKDIR /app # Copy package files COPY web/package*.json ./ RUN npm ci # Copy source code COPY web/ ./ # Set build-time environment variable for API gateway URL ARG VITE_GATEWAY_URL=https://deepthoughtai-evo-gateway.hf.space ENV VITE_GATEWAY_URL=$VITE_GATEWAY_URL # Increase Node.js heap to prevent OOM-kill (exit 137) during Vite/tsc build ENV NODE_OPTIONS=--max-old-space-size=2048 # Build the app (Vite will use VITE_GATEWAY_URL) RUN npm run build # Production stage - serve with nginx FROM nginx:alpine # Copy built files COPY --from=builder /app/dist /usr/share/nginx/html # Copy nginx configuration COPY web/nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 7860 CMD ["nginx", "-g", "daemon off;"]