FROM python:3.9.9-slim # Copy static ffmpeg binaries COPY --from=mwader/static-ffmpeg:6.0 /ffmpeg /usr/local/bin/ COPY --from=mwader/static-ffmpeg:6.0 /ffprobe /usr/local/bin/ # Set working directory WORKDIR /app # Copy requirements first to leverage Docker cache COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Download the models and clean up cache in the same layer COPY download_model.py . RUN python download_model.py && \ rm -rf /root/.cache/huggingface # Copy the rest of the application COPY . . # Expose the port EXPOSE 7860 # Run the application CMD gunicorn --bind 0.0.0.0:${PORT:-7860} --workers 1 --threads 8 --timeout 0 "app:app"