# Use python 3.11 slim image FROM python:3.11-slim # Set environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 # Set working directory WORKDIR /app # Install system dependencies for OpenCV and image handling RUN apt-get update && apt-get install -y \ build-essential \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install dependencies COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy the entire backend server codebase COPY . . # Expose port 7860 (Hugging Face Spaces default container port) EXPOSE 7860 # Run FastAPI using uvicorn on port 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]