# Stage 1: Build the React app FROM node:18 AS build WORKDIR /app/frontend COPY frontend/package.json ./ RUN npm install COPY frontend/src ./src RUN npm run build # Stage 2: Set up FastAPI FROM python:3.12-slim WORKDIR /app # Install FastAPI and Uvicorn COPY app/requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt # Copy the built React app from the previous stage COPY --from=build /app/frontend/build ./frontend/build COPY app/main.py ./app/ # Command to run the FastAPI app CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]