diff --git a/Dockerfile b/Dockerfile index e189793..9b03704 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,8 +35,7 @@ RUN --mount=type=cache,id=apt-build,target=/var/cache/apt \ mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ apt-get update && \ apt-get install --yes --no-install-recommends \ - python3 python3-pip python3-venv \ - build-essential python3-dev + python3 python3-pip python3-venv WORKDIR /home/mimic3/app diff --git a/Dockerfile.gpu b/Dockerfile.gpu index a62089a..a027782 100644 --- a/Dockerfile.gpu +++ b/Dockerfile.gpu @@ -40,13 +40,17 @@ RUN --mount=type=cache,id=apt-run,target=/var/cache/apt \ WORKDIR /home/mimic3/app -COPY ./ ./ +COPY opentts-abc/ ./opentts-abc/ +COPY mimic3-http/ ./mimic3-http/ +COPY mimic3-tts/ ./mimic3-tts/ +COPY install.sh ./ -# Fix requirements +# Use GPU version of onnxruntime RUN sed -i 's/onnxruntime/onnxruntime-gpu/' mimic3-tts/requirements.txt # Install mimic3 RUN --mount=type=cache,id=pip-requirements,target=/root/.cache/pip \ + PIP_INSTALL='install -f https://synesthesiam.github.io/prebuilt-apps/' \ ./install.sh RUN useradd -ms /bin/bash mimic3 diff --git a/.dockerignore b/Dockerfile.gpu.dockerignore similarity index 78% rename from .dockerignore rename to Dockerfile.gpu.dockerignore index 7343633..6afb7f8 100644 --- a/.dockerignore +++ b/Dockerfile.gpu.dockerignore @@ -1,18 +1,7 @@ * -!LICENSE !install.sh -!build-dist.sh -!check.sh -!test.sh -!requirements_dev.txt -!.isort.cfg -!pylintrc -!setup.cfg -!pyinstaller/*.py -!pyinstaller/mimic3-server -!pyinstaller/mimic3-download -!tests/*.py -!tests/sample_hashes.txt +!tests/apope_sample.txt +!tests/apope_sample_*.wav !voices/ # opentts-abc diff --git a/Dockerfile.test b/Dockerfile.test deleted file mode 100644 index 431aaaf..0000000 --- a/Dockerfile.test +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2022 Mycroft AI Inc. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# ----------------------------------------------------------------------------- -# Dockerfile for Mimic 3 (https://github.com/MycroftAI/mimic3) -# -# Runs code checks and creates source code distributions for PyPI. -# -# Requires Docker buildx: https://docs.docker.com/buildx/working-with-buildx/ -# ----------------------------------------------------------------------------- -FROM debian:bullseye - -ARG TARGETARCH -ARG TARGETVARIANT - -ENV LANG C.UTF-8 -ENV DEBIAN_FRONTEND=noninteractive - -RUN echo "Dir::Cache var/cache/apt/${TARGETARCH}${TARGETVARIANT};" > /etc/apt/apt.conf.d/01cache - -RUN --mount=type=cache,id=apt-run,target=/var/cache/apt \ - mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ - apt-get update && \ - apt-get install --yes --no-install-recommends \ - python3 python3-venv python3-pip libespeak-ng1 - -WORKDIR /build/mimic3 -COPY ./ ./ - -# Install mimic3 -RUN --mount=type=cache,id=pip-venv,target=/root/.cache/pip \ - ./install.sh - -# Run tests -COPY voices/ /usr/share/mimic3/voices/ -RUN ./test.sh --no-download diff --git a/debian/build-debian.sh b/debian/build-debian.sh deleted file mode 100755 index 738ab27..0000000 --- a/debian/build-debian.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2022 Mycroft AI Inc. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# ----------------------------------------------------------------------------- -# Script for building Debian packages from PyInstaller binaries. -# -# Before running this script, you must build PyInstaller binaries with "make -# binaries" or by manually invoking Dockerfile.binary. -# ----------------------------------------------------------------------------- -set -eo pipefail - -# Directory of *this* script -this_dir="$( cd "$( dirname "$0" )" && pwd )" -src_dir="$(realpath "${this_dir}/..")" -dist_dir="${src_dir}/dist/linux" - -voices_dir="${src_dir}/../mimic3-voices/voices" -src_voice_dir="${voices_dir}/en_UK/apope_low" - -version="$(cat "${src_dir}/mimic3-tts/mimic3_tts/VERSION")" - -if [ -z "$1" ]; then - # All platforms - platforms=('amd64' 'arm64' 'arm/v7') -else - # Only platforms from command-line arguments - platforms=("$@") -fi - -# Create Debian package for each platform -for platform in "${platforms[@]}"; do - platform_dir="${dist_dir}/${platform}" - if [ -d "${platform_dir}" ]; then - # Create temporary directory for building - temp_dir="$(mktemp -d)" - function cleanup { - rm -rf "${temp_dir}"; - } - trap cleanup EXIT - - package_dir="${temp_dir}/mimic3-tts" - mkdir -p "${package_dir}" - - # Fix Debian arch name - case "${platform}" in - arm/v7) - debian_arch='armhf' - ;; - - *) - debian_arch="${platform}" - ;; - esac - - # Create control file - mkdir -p "${package_dir}/DEBIAN" - VERSION="${version}" DEBIAN_ARCH="${debian_arch}" \ - envsubst \ - < "${src_dir}/debian/control.in" \ - > "${package_dir}/DEBIAN/control" - - # Copy artifacts - mkdir -p "${package_dir}/usr/lib/mimic3-tts" - rsync -av "${platform_dir}/mimic3/" "${package_dir}/usr/lib/mimic3-tts/" - - # Copy scripts - mkdir -p "${package_dir}/usr/bin/" - rsync -av "${this_dir}/bin/" "${package_dir}/usr/bin/" - - # Copy default voice - dest_voice_dir="${package_dir}/usr/share/mimic3/voices/en_UK/apope_low" - mkdir -p "${dest_voice_dir}" - rsync -av "${src_voice_dir}/" "${dest_voice_dir}/" - - # Build Debian package - pushd "${temp_dir}" 2>/dev/null - dpkg --build 'mimic3-tts' - dpkg-name ./*.deb - cp ./*.deb "${src_dir}/dist/" - popd 2>/dev/null - fi -done diff --git a/tests/Dockerfile.test.debian b/tests/Dockerfile.test.debian deleted file mode 100644 index f744a43..0000000 --- a/tests/Dockerfile.test.debian +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright 2022 Mycroft AI Inc. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# ----------------------------------------------------------------------------- -# Dockerfile for Mimic 3 (https://github.com/MycroftAI/mimic3) -# -# Tests installation and functionality of Mimic 3 Debian package. -# -# Requires Docker buildx: https://docs.docker.com/buildx/working-with-buildx/ -# ----------------------------------------------------------------------------- -FROM debian:bullseye as test - -ARG TARGETARCH -ARG TARGETVARIANT - -ENV LANG C.UTF-8 -ENV DEBIAN_FRONTEND=noninteractive - -RUN echo "Dir::Cache var/cache/apt/${TARGETARCH}${TARGETVARIANT};" > /etc/apt/apt.conf.d/01cache - -RUN --mount=type=cache,id=apt-run,target=/var/cache/apt \ - mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ - apt-get update && \ - apt-get install --yes --no-install-recommends \ - dpkg-dev - -WORKDIR /test - -COPY dist/*.deb ./ -COPY mimic3-tts/mimic3_tts/VERSION ./ - -# Install mimic3 for current architecture -RUN --mount=type=cache,id=apt-run,target=/var/cache/apt \ - export mimic3_version="$(cat VERSION)" && \ - dpkg-architecture | \ - grep 'DEB_HOST_ARCH=' | \ - sed -e 's/.\+=//' | \ - xargs printf "./mimic3-tts_${mimic3_version}_%s.deb" | \ - xargs apt install --yes - -# Version check -RUN export expected_version="$(cat VERSION)" && \ - export actual_version="$(mimic3 --version)" && \ - if [ ! "${expected_version}" = "${actual_version}"]; then \ - echo "${actual_version} != ${expected_version}"; \ - exit 1; \ - fi - -# Generate sample and check -COPY tests/apope_sample.* ./ -RUN mimic3 \ - --deterministic \ - --voice 'en_UK/apope_low' \ - < apope_sample.txt \ - > actual_sample.wav - -# RUN diff apope_sample.wav actual_sample.wav - -# ----------------------------------------------------------------------------- - -FROM scratch - -COPY --from=test /test/actual_sample.wav ./ diff --git a/tests/Dockerfile.test.debian.dockerignore b/tests/Dockerfile.test.debian.dockerignore deleted file mode 100644 index 6968011..0000000 --- a/tests/Dockerfile.test.debian.dockerignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!dist/*.deb -!mimic3-tts/mimic3_tts/VERSION -!tests/apope_sample.wav -!tests/apope_sample.txt diff --git a/tests/Dockerfile.test.docker b/tests/Dockerfile.test.docker deleted file mode 100644 index 56182c0..0000000 --- a/tests/Dockerfile.test.docker +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2022 Mycroft AI Inc. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# ----------------------------------------------------------------------------- -# Dockerfile for Mimic 3 (https://github.com/MycroftAI/mimic3) -# -# Tests installation and functionality of Mimic 3 Docker image. -# -# Requires Docker buildx: https://docs.docker.com/buildx/working-with-buildx/ -# ----------------------------------------------------------------------------- -FROM mycroftai/mimic3 - -ARG TARGETARCH -ARG TARGETVARIANT - -ENV LANG C.UTF-8 - -WORKDIR /test - -COPY mimic3-tts/mimic3_tts/VERSION ./ - -# Install mimic3 for current architecture -RUN --mount=type=cache,id=apt-run,target=/var/cache/apt \ - export mimic3_version="$(cat VERSION)" && \ - dpkg-architecture | \ - grep 'DEB_HOST_ARCH=' | \ - sed -e 's/.\+=//' | \ - xargs printf "./mimic3-tts_${mimic3_version}_%s.deb" | \ - xargs apt install --yes - -# Version check -RUN export expected_version="$(cat VERSION)" && \ - export actual_version="$(mimic3 --version)" && \ - if [ ! "${expected_version}" = "${actual_version}"]; then \ - echo "${actual_version} != ${expected_version}"; \ - exit 1; \ - fi - -# Generate sample and check -COPY tests/apope_sample.* ./ -RUN mimic3 \ - --deterministic \ - --voice 'en_UK/apope_low' \ - < apope_sample.txt \ - > actual_sample.wav - -RUN diff apope_sample.wav actual_sample.wav diff --git a/tests/Dockerfile.test.docker.dockerignore b/tests/Dockerfile.test.docker.dockerignore deleted file mode 100644 index 84962cd..0000000 --- a/tests/Dockerfile.test.docker.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!mimic3-tts/mimic3_tts/VERSION -!tests/apope_sample.wav -!tests/apope_sample.txt