Download docs/Deploy.md from binhtommy/vieneu: direct link, hf CLI and curl.
- Browser
- Download file 5.22 kB
-
https://huggingface.co/spaces/binhtommy/vieneu/resolve/main/docs/Deploy.md
- Command line
-
hf download hf://spaces/binhtommy/vieneu/docs/Deploy.md
-
curl -L -o Deploy.md https://huggingface.co/spaces/binhtommy/vieneu/resolve/main/docs/Deploy.md
A newer version of the Gradio SDK is available: 6.32.0
π³ Docker Deployment Guide for VieNeu-TTS
π Table of Contents
- System Requirements
- Quick Start Guide (Dev)
- Production Deployment
- Production Deployment Workflow
- Remote Server Deployment (One-Command)
- Configuration
- Troubleshooting
π₯οΈ System Requirements
- Docker: Version 20.10 or higher
- Docker Compose: Version 2.20 or higher
- NVIDIA Docker Runtime (for GPU variants): Requires
nvidia-container-toolkitinstallation.
π Quick Start Guide (Dev)
The Development environment is designed to allow you to edit code on your host machine (Windows/Linux) and run it immediately in Docker without rebuilding the image.
1. Startup (App + Interactive)
Run the following command to start the Web UI. You can also open another terminal to exec into the container.
Note: Docker deployment currently supports GPU only. For CPU usage, please install from source (see main README).
# GPU only
docker compose -f docker/docker-compose.yml --profile gpu up
Access: http://localhost:7860
2. Run Manual Commands (Optional)
If you want to run scripts manually in the running container:
docker compose exec gpu bash
In the shell, you can run: uv run examples/main.py, uv run examples/infer_long_text.py, ...
The current directory code is mounted to /workspace, so when you edit code outside, it updates immediately in the container.
π’ Production Deployment
The Production environment uses docker/docker-compose.prod.yml. Source code will be copied into the image (no volume mount), ensuring stability and portability. By default, these services will automatically run the Web UI.
Standard workflow:
- Build Image: Use
docker/docker-compose.build.yml. - Push to Registry: Push the image to Docker Hub / Private Registry.
- Deploy: On the server, use
docker/docker-compose.prod.ymlto pull and run.
ποΈ Production Deployment Workflow
1. Build Docker Image
Copy .env.example to .env and set your image name (e.g., myregistry.com/vieneu-tts-gpu):
IMAGE_NAME=myregistry.com/vieneu-tts-gpu
IMAGE_TAG=v1.0.0
Run the build command:
# Build both (if needed) or specify service
docker compose -f docker/docker-compose.build.yml build gpu
2. Push Image
docker compose -f docker/docker-compose.build.yml push gpu
3. Run on Production
On the production server, you only need the docker/docker-compose.prod.yml file and the .env file.
Startup:
# Pull the latest image
docker compose -f docker/docker-compose.prod.yml --profile gpu pull
# Start the service
docker compose -f docker/docker-compose.prod.yml --profile gpu up -d
π Remote Server Deployment (One-Command)
To enable the "One-Command" deployment experience for your users (where they just run docker run ... and it works purely from the cloud), you must build and push the special server image to Docker Hub.
1. Build & Push Image
We have prepared Makefile targets for this specific purpose:
# 1. Login to Docker Hub (if you haven't)
docker login
# 2. Build the server image
make docker-build-serve
# 3. Push to Docker Hub
make docker-push-serve
Note: The image is tagged pnnbao97/vieneu-tts:serve by default. Update the Makefile if you use a different registry.
2. User Experience
Once pushed, ANY user with an NVIDIA GPU can run your server with a single command (no repo cloning needed):
docker run --runtime nvidia --gpus all \
-v ~/.cache/huggingface:/root/.cache/huggingface \
pnnbao97/vieneu-tts:serve
This image is optimized purely for serving the API (minimal size, pre-installed dependencies).
βοΈ Configuration
Profiles
We use Docker Compose Profiles to manage variants:
| Profile | Environment | File | Description |
|---|---|---|---|
gpu |
Dev | docker/docker-compose.yml |
Dev mode (Mount code + Web UI + GPU) |
gpu |
Prod | docker/docker-compose.prod.yml |
Run mode (Baked code + Web UI + GPU) |
Environment Variables
Important environment variables (already set in docker-compose):
HF_HOME: HuggingFace cache path (mounted as volumehuggingface_cache).PHONEMIZER_ESPEAK_LIBRARY: espeak library path.
π§ Troubleshooting
1. GPU Not Detected
Make sure you have installed nvidia-container-toolkit and the latest drivers. Test with:
docker run --rm --gpus all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smi
2. Permission Error When Editing Files (Linux)
Due to volume mounting, files created in Docker may be owned by root. You may need to change ownership:
sudo chown -R $USER:$USER output_audio/
(On Windows Docker Desktop, this issue does not occur).