# Use official Python image as base FROM python:3.9-slim # Set the working directory inside the container WORKDIR /app # Install system dependencies for OpenCV and other libraries RUN apt-get update && apt-get install -y \ libgl1-mesa-glx \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Copy the requirements file COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the model and application files COPY . . # Expose the FastAPI port (7860 for Hugging Face) EXPOSE 7860 # Run FastAPI with Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]