Skip to content

Commit

Permalink
Merge pull request #94 from NeonGeckoCom/dev
Browse files Browse the repository at this point in the history
Docker Fixes and Automation
  • Loading branch information
NeonDaniel authored Feb 15, 2023
2 parents c6907c0 + 8c48260 commit 066b678
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 56 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/publish_docker.yml

This file was deleted.

52 changes: 50 additions & 2 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
branches:
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
tag_release:
runs-on: ubuntu-latest
Expand All @@ -19,7 +23,7 @@ jobs:
with:
token: ${{secrets.GITHUB_TOKEN}}
tag: ${{env.VERSION}}
build_and_publish:
build_and_publish_pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -35,6 +39,50 @@ jobs:
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{secrets.PYPI_TOKEN}}
build_and_publish_docker:
runs-on: ubuntu-latest
needs: build_and_publish_pypi
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get Version
id: version
run: |
VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version))
echo ::set-output name=version::${VERSION}
env:
image_name: ${{ env.IMAGE_NAME }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=raw,value=latest
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
51 changes: 49 additions & 2 deletions .github/workflows/publish_test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ on:
paths-ignore:
- 'version.py'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build_and_publish:
build_and_publish_pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -34,6 +38,49 @@ jobs:
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{secrets.PYPI_TOKEN}}
build_and_publish_docker:
runs-on: ubuntu-latest
needs: build_and_publish_pypi
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get Version
id: version
run: |
VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version))
echo ::set-output name=version::${VERSION}
env:
image_name: ${{ env.IMAGE_NAME }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
FROM python:3.9-slim-bullseye AS compile-image

RUN apt-get update -y && apt-get install -y python3-pip
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

RUN pip3 install --user neon-tts-plugin-coqui --no-cache-dir
RUN pip3 install --user ovos-tts-server==0.0.2 --no-cache-dir
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

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

RUN apt-get update -y && apt-get install -y --no-install-recommends espeak-ng
COPY --from=compile-image /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH

ENTRYPOINT ovos-tts-server --engine neon-tts-plugin-coqui
ENTRYPOINT ovos-tts-server --engine coqui
7 changes: 5 additions & 2 deletions neon_tts_plugin_coqui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,20 @@ def __init__(self, lang="en", config=None, *args, **kwargs):
self._init_model({"lang": lang})

def get_tts(self, sentence: str, output_file: str,
speaker: Optional[dict] = None) -> (str, Optional[str]):
speaker: Optional[dict] = None, lang: Optional[str] = None) -> (str, Optional[str]):
"""
Get Synthesized audio
Args:
sentence: string to synthesize
output_file: path to output audio file
speaker: optional dict speaker data
lang: optional lang override
Returns:
tuple wav_file, optional phonemes
"""
if lang:
speaker = speaker or dict()
speaker['language'] = lang
wav_data, synthesizer = self.get_audio(sentence, speaker,
audio_format="internal")
self._audio_to_file(wav_data, synthesizer, output_file)
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

__version__ = "0.7.1"
__version__ = "0.7.2"

0 comments on commit 066b678

Please sign in to comment.