Build From Source#

This page covers building the Text To Speech microservice from source. Use this path when you need a code change. To run the prebuilt image from Docker Hub without rebuilding, see Run with Docker Compose.

Prerequisites#

  • Verify the System Requirements.

  • Clone the repository and cd into the text-to-speech/ directory.

Build the Docker Image#

The repository ships a Dockerfile and a docker-compose.yml. The compose file declares both image: and build: for the service:

  • docker compose pull && docker compose up -d runs the prebuilt image from Docker Hub.

  • docker compose build && docker compose up -d rebuilds the result from source and tags as the same ${REGISTRY}/text-to-speech:${RELEASE_TAG}, so subsequent docker compose up calls reuse the local build.

docker compose build
docker compose up -d

To build the image directly with docker:

docker build -t text-to-speech:local .

The Compose setup bind-mounts config.yaml and stores model, storage, and Hugging Face cache data in named Docker volumes (text_to_speech_{models,storage,cache}), and passes /dev/dri through for host Intel iGPU access by default. The container runs as UID/GID 1000:1000 by default; see Troubleshooting if your host user differs.

Build a Python Environment (Standalone)#

Install host packages, then create a virtual environment and install Python dependencies from source:

sudo apt-get update
sudo apt-get install -y libsndfile1

python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
python main.py

Verifying the Build#

After building and starting the service, confirm:

curl --noproxy '*' http://127.0.0.1:8011/health

A {"status": "ok"} response confirms the build is functional.