| # Generated at 2026-01-29T20:46:31Z from templates/space/Dockerfile.j2 | |
| # | |
| # TorToise HuggingFace Space - Dockerfile | |
| # Uses Docker SDK for more control over dependencies and environment | |
| FROM python:3.10-slim | |
| # Install system dependencies (as root) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git \ | |
| git-lfs \ | |
| libsox-dev \ | |
| ffmpeg \ | |
| gcc \ | |
| build-essential \ | |
| g++-12 \ | |
| espeak-ng | |
| # Set up user (UID 1000 as required by HuggingFace Spaces) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Upgrade pip | |
| RUN pip install --no-cache-dir --upgrade pip | |
| # Install PyTorch (CPU version for Spaces - GPU available at runtime if hardware supports it) | |
| RUN pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu | |
| # Install the external PyPI package (if specified) and the ttsdb wrapper from PyPI | |
| RUN pip install --no-cache-dir ttsdb_tortoise==0.1.1 | |
| # Install Gradio | |
| RUN pip install --no-cache-dir gradio>=5.15.0 | |
| # Copy the app | |
| COPY --chown=user app.py $HOME/app/ | |
| # Copy packaged audio examples into the app examples directory (if present) | |
| COPY --chown=user examples $HOME/app/examples | |
| # Expose port (HuggingFace Spaces will map this) | |
| EXPOSE 7860 | |
| # Run the app | |
| CMD ["python", "app.py"] | |