From 9a99267e9bac381b9e4795ab3c40d25e9d7fe9e1 Mon Sep 17 00:00:00 2001 From: edurenye Date: Fri, 6 Oct 2023 20:05:49 +0200 Subject: [PATCH] Add docker compose and instructions --- README.md | 48 +++++++++++++++++++++++++++++++++++++++++ docker-compose.base.yml | 35 ++++++++++++++++++++++++++++++ docker-compose.gpu.yml | 44 +++++++++++++++++++++++++++++++++++++ piper/GPU.Dockerfile | 2 +- piper/NONGPU.Dockerfile | 2 +- 5 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 docker-compose.base.yml create mode 100644 docker-compose.gpu.yml diff --git a/README.md b/README.md index 163a857..050396b 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,51 @@ docker run -it -p 10300:10300 -v /path/to/local/data:/data rhasspy/wyoming-whisp ``` sh docker run -it -p 10200:10200 -v /path/to/local/data:/data rhasspy/wyoming-piper --voice en_US-lessac-medium ``` + +## To run in standalone server + +### Run without GPU + +Build openwakeword, piper and whisper without GPU with: + +``` sh +docker compose -f docker-compose.base.yml build --no-cache +``` + +Run it with: + +``` sh +docker composer -f docker-compose.base.yml up -d +``` + +Take it down with: + +``` sh +docker composer down +``` + +### Run with GPU + +Build openwakeword, piper and whisper with GPU with: + +``` sh +docker compose -f docker-compose.gpu.yml build --no-cache +``` + +Run it with: + +``` sh +docker composer -f docker-compose.gpu.yml up -d +``` + +Take it down with: + +``` sh +docker composer down +``` + +### Extend it + +You can extend those files adding your own languages. +More on docker compose extend in the [official documentation](https://docs.docker.com/compose/multiple-compose-files/extends/). + diff --git a/docker-compose.base.yml b/docker-compose.base.yml new file mode 100644 index 0000000..f832e83 --- /dev/null +++ b/docker-compose.base.yml @@ -0,0 +1,35 @@ +version: '3' +services: + wyoming-piper: + build: + context: ./piper/ + dockerfile: NONGPU.Dockerfile + ports: + - "10200:10200" + volumes: + - ./piper-data:/data + command: [ "--voice", "en_US-lessac-medium" ] + restart: unless-stopped + + wyoming-whisper: + build: + context: ./whisper/ + dockerfile: NONGPU.Dockerfile + ports: + - "10300:10300" + volumes: + - ./whisper-data:/data + command: [ "--model", "tiny-int8", "--language", "en" ] + restart: unless-stopped + + wyoming-openwakeword: + build: + context: ./openwakeword/ + dockerfile: NONGPU.Dockerfile + ports: + - "10400:10400" + volumes: + - ./openwakeword-data:/data + command: [ "--model", "hey_jarvis" ] + restart: unless-stopped + diff --git a/docker-compose.gpu.yml b/docker-compose.gpu.yml new file mode 100644 index 0000000..6a4e7ed --- /dev/null +++ b/docker-compose.gpu.yml @@ -0,0 +1,44 @@ +version: '3' +services: + wyoming-piper: + extends: + file: docker-compose.base.yml + service: wyoming-piper + build: + dockerfile: GPU.Dockerfile + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + + wyoming-whisper: + extends: + file: docker-compose.base.yml + service: wyoming-whisper + build: + dockerfile: GPU.Dockerfile + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + + wyoming-openwakeword: + extends: + file: docker-compose.base.yml + service: wyoming-openwakeword + build: + dockerfile: GPU.Dockerfile + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + diff --git a/piper/GPU.Dockerfile b/piper/GPU.Dockerfile index 2c017fe..8bdf40b 100644 --- a/piper/GPU.Dockerfile +++ b/piper/GPU.Dockerfile @@ -32,4 +32,4 @@ COPY run-gpu.sh ./ EXPOSE 10200 -ENTRYPOINT ["bash", "/run.sh"] +ENTRYPOINT ["bash", "/run-gpu.sh"] diff --git a/piper/NONGPU.Dockerfile b/piper/NONGPU.Dockerfile index ea9fe8b..36feee0 100644 --- a/piper/NONGPU.Dockerfile +++ b/piper/NONGPU.Dockerfile @@ -31,4 +31,4 @@ COPY run-nongpu.sh ./ EXPOSE 10200 -ENTRYPOINT ["bash", "/run.sh"] +ENTRYPOINT ["bash", "/run-nongpu.sh"]