FROM python:3.12-slim # Install system dependencies RUN apt-get update && apt-get install -y \ git \ git-lfs \ ffmpeg \ libsm6 \ libxext6 \ libgl1 \ && rm -rf /var/lib/apt/lists/* \ && git lfs install # Setup user permissions for Hugging Face RUN useradd -m -u 1000 user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy requirements and handle dependencies safely COPY --chown=user requirements.txt $HOME/app/requirements.txt RUN python -m pip install --upgrade pip setuptools wheel \ && python -m pip install --no-cache-dir -r requirements.txt \ && python -m pip install --no-cache-dir "uvicorn>=0.14.0" "websockets>=10.4" spaces COPY --chown=user . $HOME/app USER user EXPOSE 7860 CMD ["python", "app.py"]