FROM python:3.10-slim WORKDIR /app # Install system libraries required by opencv RUN apt-get update && apt-get install -y \ libxcb1 \ libglib2.0-0 \ libgl1 \ && rm -rf /var/lib/apt/lists/* # Install headless opencv first (no display needed on a server) RUN pip install --no-cache-dir opencv-python-headless # Install the rest of the dependencies RUN pip install --no-cache-dir \ fastapi \ uvicorn \ python-multipart \ ultralytics \ huggingface_hub \ pillow COPY app.py . EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]