Skip to content

Commit

Permalink
Update Docker to include Gradio web UI (#102)
Browse files Browse the repository at this point in the history
* Adds docker dependencies with ovos-tts-server
Simplifies Dockerfile and adds args to start gradio server

* Revert Dockerfile changes to keep reduced image size

* Add `--no-install-cache-dir` and `--no-install-recommends` flags
  • Loading branch information
NeonDaniel authored May 11, 2023
1 parent 8c48260 commit 76faf3e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.env
.git
.git
Dockerfile
27 changes: 15 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
FROM python:3.9-slim-bullseye AS compile-image

RUN apt-get update -y && apt-get install -y python3-pip git

RUN pip3 install --user torch --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu
FROM python:3.9-slim AS compile-image

COPY . /tmp/neon-tts-plugin-coqui
RUN pip3 install --user /tmp/neon-tts-plugin-coqui --no-cache-dir

RUN pip3 install --user git+https://github.com/OpenVoiceOS/ovos-tts-server@b9ee84c48ab6ab5655fffa032359752ab10d2c9d
RUN pip install wheel && \
pip install --user --no-cache-dir \
/tmp/neon-tts-plugin-coqui/[docker] --extra-index-url https://download.pytorch.org/whl/cpu

FROM python:3.9-slim-bullseye AS build-image

RUN apt-get update -y && apt-get install -y --no-install-recommends espeak-ng
# Copy built packages to a clean image to exclude build-time extras from final image
FROM python:3.9-slim AS build-image
COPY --from=compile-image /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH

ENTRYPOINT ovos-tts-server --engine coqui
RUN apt-get update && \
apt-get install -y --no-install-recommends \
espeak-ng

ENTRYPOINT ovos-tts-server --engine coqui --gradio \
--title "🐸💬 - NeonAI Coqui AI TTS Plugin" \
--description "🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production" \
--info "more info at [Neon Coqui TTS Plugin](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui), [Coqui TTS](https://github.com/coqui-ai/TTS)" \
--badge "https://visitor-badge-reloaded.herokuapp.com/badge?page_id=neongeckocom.neon-tts-plugin-coqui"
1 change: 1 addition & 0 deletions requirements/docker.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ovos-tts-server>=0.0.3a5
6 changes: 5 additions & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ numpy>=1.19.5
torch~=1.9,!=1.13.0
# dependencies
ovos-plugin-manager~=0.0.2
ovos-utils~=0.0.32
psutil
# huggingface
huggingface-hub
huggingface-hub

mycroft-messagebus-client~=0.10
# TODO: Above patching OPM dependency
13 changes: 9 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,23 @@


def get_requirements(requirements_filename: str):
requirements_file = path.join(path.abspath(path.dirname(__file__)), "requirements", requirements_filename)
requirements_file = path.join(path.abspath(path.dirname(__file__)),
"requirements", requirements_filename)
with open(requirements_file, 'r', encoding='utf-8') as r:
requirements = r.readlines()
requirements = [r.strip() for r in requirements if r.strip() and not r.strip().startswith("#")]
requirements = [r.strip() for r in requirements if r.strip() and not
r.strip().startswith("#")]

for i in range(0, len(requirements)):
r = requirements[i]
if "@" in r:
parts = [p.lower() if p.strip().startswith("git+http") else p for p in r.split('@')]
parts = [p.lower() if p.strip().startswith("git+http") else p
for p in r.split('@')]
r = "@".join(parts)
if getenv("GITHUB_TOKEN"):
if "github.com" in r:
r = r.replace("github.com", f"{getenv('GITHUB_TOKEN')}@github.com")
r = r.replace("github.com",
f"{getenv('GITHUB_TOKEN')}@github.com")
requirements[i] = r
return requirements

Expand Down Expand Up @@ -74,6 +78,7 @@ def get_requirements(requirements_filename: str):
license='BSD-3.0',
packages=find_packages(),
install_requires=get_requirements("requirements.txt"),
extras_require={"docker": get_requirements("docker.txt")},
zip_safe=True,
classifiers=[
'Intended Audience :: Developers',
Expand Down

0 comments on commit 76faf3e

Please sign in to comment.