FROM python:3.9-slim # Install system dependencies including FFmpeg, fontconfig, and build tools RUN apt-get update && apt-get install -y \ ffmpeg \ git \ git-lfs \ fontconfig \ libfontconfig1 \ libfreetype6 \ build-essential \ python3-dev \ gcc \ g++ \ make \ libffi-dev \ libssl-dev \ && rm -rf /var/lib/apt/lists/* \ && git lfs install WORKDIR /app # First upgrade pip and install setuptools RUN pip install --no-cache-dir --upgrade pip setuptools wheel # Copy requirements first for better caching COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the app COPY . . # Create font directory and set permissions RUN mkdir -p /usr/share/fonts/custom && \ chmod -R 755 /usr/share/fonts/custom # Expose the port EXPOSE 7860 # Run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]