FROM python:3.11-slim RUN apt-get update && apt-get install -y \ pkg-config \ libavformat-dev \ libavcodec-dev \ libavdevice-dev \ libavutil-dev \ libswscale-dev \ libswresample-dev \ libavfilter-dev \ ffmpeg \ git \ build-essential \ && rm -rf /var/lib/apt/lists/* WORKDIR /app RUN pip install --no-cache-dir --upgrade pip setuptools wheel RUN pip install --no-cache-dir torch torchvision torchaudio RUN pip install --no-cache-dir torchcodec RUN pip install --no-cache-dir av COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN python -m spacy download en_core_web_sm RUN pip install --no-cache-dir --no-deps git+https://github.com/facebookresearch/audiocraft.git COPY . . RUN useradd -m -u 1000 user RUN chown -R user:user /app USER user ENV TORCHAUDIO_USE_BACKEND_DISPATCHER=1 EXPOSE 7860 CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "600", "app:app"]