# Stage 1: Build the React frontend FROM node:18 AS frontend-build WORKDIR /app/frontend COPY frontend/package.json frontend/package-lock.json ./ RUN npm ci COPY frontend ./ RUN npm run build # Stage 2: Build the Python backend FROM python:3.10-slim AS backend WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . # Copy the built React frontend from the previous stage COPY --from=frontend-build /app/frontend/build ./frontend/build # Expose the port and run the FastAPI app CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]