# Stage 1: Build the React Frontend FROM node:18 AS build-frontend WORKDIR /app/frontend COPY toothmap_frontend/package*.json ./ RUN npm install COPY toothmap_frontend/ ./ RUN npm run build # Stage 2: Setup the Python Backend FROM python:3.12-slim WORKDIR /app # Install system dependencies required by OpenCV RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy models COPY checkpoints/ /app/checkpoints/ # Copy backend code COPY toothmap_backend/ /app/ # Copy built React frontend to static folder COPY --from=build-frontend /app/frontend/dist /app/static # Expose Hugging Face default port EXPOSE 7860 # Run FastAPI serving both the backend APIs and frontend static files CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]