Spaces:
Runtime error
Runtime error
File size: 1,678 Bytes
2f75245 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | FROM python:3.11-slim
# ββ System packages ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# espeak-ng + libsndfile1: required by piper-tts at runtime
# build-essential + cmake + git: required to compile llama-cpp-python from source
RUN apt-get update && apt-get install -y --no-install-recommends \
espeak-ng \
libsndfile1 \
ffmpeg \
build-essential \
cmake \
git \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# ββ HF Spaces requirement: non-root user uid 1000 ββββββββββββββββββββββββββββ
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1
WORKDIR /home/user/app
# ββ Python dependencies βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# CMAKE_BUILD_PARALLEL_LEVEL=1 limits llama-cpp-python C++ compilation to a
# single parallel job, reducing peak RAM from ~12 GB (all CPUs) to ~3 GB.
# Without this the build container is OOMKilled before compilation finishes.
COPY --chown=user requirements.txt .
ENV CMAKE_BUILD_PARALLEL_LEVEL=1
RUN pip install --no-cache-dir -r requirements.txt
# ββ Application βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
COPY --chown=user . .
EXPOSE 7860
CMD ["python", "app.py"]
|