# Use the official Python 3.9 image FROM python:3.9-slim # Set the working directory WORKDIR /app RUN mkdir -p /tmp/Ultralytics && chmod -R 777 /tmp/Ultralytics ENV YOLO_CONFIG_DIR=/tmp/Ultralytics # Install system dependencies # We use libgl1 and libglib2.0-0 which are the modern equivalents RUN apt-get update && apt-get install -y \ libgl1 \ 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 everything else COPY . . # Expose port 7860 for Hugging Face EXPOSE 7860 # Command to run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]