FROM python:3.11-slim # Install system dependencies for OpenCV and HF RUN apt-get update && apt-get install -y \ git \ git-lfs \ curl \ libgl1-mesa-glx \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Install production dependencies RUN pip install --no-cache-dir huggingface_hub[cli] gunicorn eventlet WORKDIR /app # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Ensure scripts are executable RUN chmod +x entrypoint.sh # HF Spaces default user is 1000 RUN useradd -m -u 1000 user RUN chown -R user:user /app USER user ENV HOME=/home/user ENV PATH=/home/user/.local/bin:$PATH # Environment variables ENV PORT=7680 ENV PYTHONUNBUFFERED=1 EXPOSE 7680 CMD ["./entrypoint.sh"]