# backend/Dockerfile FROM python:3.11-slim # Install system dependencies (useful for OpenCV/vision libraries if needed later) RUN apt-get update && apt-get install -y \ build-essential \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Hugging Face requires a non-root user for security RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy requirements and install COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY --chown=user . . # Hugging Face routes traffic to port 7860 EXPOSE 7860 # Run the FastAPI server CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]