l / Dockerfile
Arabi32's picture
Rename Dockerfile (1) to Dockerfile
6a20b42 verified
# ── Base image ────────────────────────────────────────────────────────
FROM python:3.10-slim
# ── System deps (audio libs required by TTS / soundfile) ──────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libsndfile1 \
ffmpeg \
git \
&& rm -rf /var/lib/apt/lists/*
# ── HuggingFace Spaces: non-root user uid=1000 ────────────────────────
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
# Accept Coqui TOS automatically
COQUI_TOS_AGREED=1 \
# Keep HF model cache inside the container's writable home
HF_HOME=/home/user/.cache/huggingface \
# Avoid tokeniser parallelism warnings
TOKENIZERS_PARALLELISM=false
WORKDIR $HOME/app
# ── Python deps ───────────────────────────────────────────────────────
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# ── App code ─────────────────────────────────────────────────────────
COPY --chown=user app.py .
# ── Runtime dirs (writable by user 1000) ─────────────────────────────
RUN mkdir -p /home/user/app/voice_library /home/user/app/outputs
# ── HuggingFace Spaces listens on 7860 ───────────────────────────────
EXPOSE 7860
CMD ["python", "app.py"]