# Use official Python 3.10 slim image FROM python:3.10-slim # Install system dependencies RUN apt-get update && apt-get install -y \ ffmpeg \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Create a non-root user for Hugging Face Spaces RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:${PATH}" # Copy requirements and install COPY --chown=user:user requirements.txt . RUN pip install --no-cache-dir --user -r requirements.txt # Copy the rest of the application COPY --chown=user:user . . # Create uploads directory structure explicitly to ensure permissions RUN mkdir -p uploads/models uploads/videos uploads/results uploads/temp # Set environment variables ENV PORT=7860 ENV PYTHONUNBUFFERED=1 # Expose the application port EXPOSE 7860 # Command to run the application CMD ["python", "main.py"]