# 1. Use Python 3.12 to satisfy the 'perception-models' requirement FROM python:3.12 # 2. Set the working directory WORKDIR /code # 3. Install system dependencies (ffmpeg is required for audio) RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/* # 4. Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir -r requirements.txt # 5. Set up a user (Required by HF Spaces security) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # 6. Copy application files COPY --chown=user . $HOME/app # 7. Start the app CMD ["python", "app.py"]