# Start with Python 3.9 FROM python:3.9 # Install system libraries required for OpenCV RUN apt-get update && apt-get install -y libgl1 # Set working directory WORKDIR /code # Copy requirements and install dependencies COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Create a writable directory for YOLO weights & temporary files # Hugging Face runs as user 1000, so we must give permission RUN mkdir -p /code/temp_files && chmod 777 /code/temp_files # Copy the rest of the code COPY . . # Start the server on port 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]