# Stage 1: Build the React Frontend FROM node:18-slim as builder WORKDIR /app/ui/claimcheck-ui COPY ui/claimcheck-ui/package.json ui/claimcheck-ui/pnpm-lock.yaml ./ RUN npm install -g pnpm && pnpm install COPY ui/claimcheck-ui/ ./ # Set the API base URL for the production build ARG VITE_API_BASE=/ RUN VITE_API_BASE=${VITE_API_BASE} pnpm build # Stage 2: Setup the Python Backend FROM python:3.9-slim WORKDIR /app COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy backend application code COPY app ./app COPY kb ./kb COPY data ./data # Copy the built frontend from the 'builder' stage COPY --from=builder /app/ui/claimcheck-ui/dist /app/static # Expose the port the app runs on EXPOSE 7860 # Command to run the application # We will serve the static files from the built UI # And run the backend API with uvicorn CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]