Fixing docker builds
This commit is contained in:
parent
7aa7c1fd5c
commit
5f5785c57f
14 changed files with 25 additions and 120 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -15,3 +15,4 @@ dist/
|
|||
|
||||
/samples/
|
||||
/voices/
|
||||
/wheels/*.whl
|
||||
|
|
|
|||
|
|
@ -35,10 +35,14 @@ 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
|
||||
python3 python3-pip python3-venv \
|
||||
build-essential python3-dev
|
||||
|
||||
|
||||
WORKDIR /home/mimic3/app
|
||||
|
||||
COPY wheels/ ./wheels/
|
||||
|
||||
COPY opentts-abc/ ./opentts-abc/
|
||||
COPY mimic3-http/ ./mimic3-http/
|
||||
COPY mimic3-tts/ ./mimic3-tts/
|
||||
|
|
@ -46,7 +50,6 @@ COPY install.sh ./
|
|||
|
||||
# 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
|
||||
|
||||
# Download default voice
|
||||
|
|
|
|||
|
|
@ -1,110 +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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
# Dockerfile for Mimic 3 (https://github.com/MycroftAI/mimic3)
|
||||
#
|
||||
# Creates self-contained binaries using PyInstaller
|
||||
# (https://pyinstaller.readthedocs.io/en/stable/).
|
||||
#
|
||||
# Requires Docker buildx: https://docs.docker.com/buildx/working-with-buildx/
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
FROM debian:bullseye as build
|
||||
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-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 \
|
||||
libespeak-ng1
|
||||
|
||||
WORKDIR /build/mimic3
|
||||
COPY ./ ./
|
||||
|
||||
# Install mimic3
|
||||
RUN --mount=type=cache,id=pip-venv,target=/root/.cache/pip \
|
||||
PIP_INSTALL='install -f https://synesthesiam.github.io/prebuilt-apps/' \
|
||||
./install.sh
|
||||
|
||||
# Install PyInstaller
|
||||
RUN --mount=type=cache,id=pip-venv,target=/root/.cache/pip \
|
||||
.venv/bin/pip3 install 'pyinstaller>=4,<5'
|
||||
|
||||
# Create binary
|
||||
RUN .venv/bin/pyinstaller \
|
||||
--noconfirm \
|
||||
--name mimic3 \
|
||||
--hidden-import 'pycrfsuite._dumpparser' \
|
||||
--hidden-import 'pycrfsuite._logparser' \
|
||||
--collect-binaries 'onnxruntime' \
|
||||
--collect-data 'gruut' \
|
||||
--hidden-import "gruut_lang_de" \
|
||||
--collect-data "gruut_lang_de" \
|
||||
--hidden-import "gruut_lang_en" \
|
||||
--collect-data "gruut_lang_en" \
|
||||
--hidden-import "gruut_lang_es" \
|
||||
--collect-data "gruut_lang_es" \
|
||||
--hidden-import "gruut_lang_fr" \
|
||||
--collect-data "gruut_lang_fr" \
|
||||
--hidden-import "gruut_lang_it" \
|
||||
--collect-data "gruut_lang_it" \
|
||||
--hidden-import "gruut_lang_nl" \
|
||||
--collect-data "gruut_lang_nl" \
|
||||
--hidden-import "gruut_lang_ru" \
|
||||
--collect-data "gruut_lang_ru" \
|
||||
--hidden-import "gruut_lang_sw" \
|
||||
--collect-data "gruut_lang_sw" \
|
||||
--hidden-import "gruut_lang_fa" \
|
||||
--collect-data "gruut_lang_fa" \
|
||||
--collect-data 'espeak_phonemizer' \
|
||||
--collect-data 'phonemes2ids' \
|
||||
--hidden-import 'swagger_ui' \
|
||||
--hidden-import 'epitran' \
|
||||
--hidden-import 'hazm' \
|
||||
--collect-data 'hazm' \
|
||||
--collect-data 'panphon' \
|
||||
--collect-data 'mimic3_tts' \
|
||||
--collect-data 'mimic3_http' \
|
||||
pyinstaller/mimic3.py
|
||||
|
||||
# Have to manually copy these over for some reason
|
||||
RUN find .venv -name 'wapiti' -type d -exec cp -R {} dist/mimic3/ \;
|
||||
RUN find .venv -name 'libwapiti.*.so' -type f -exec cp {} dist/mimic3/ \;
|
||||
|
||||
# Clean up unused lexicons
|
||||
RUN find dist/mimic3/ -wholename '*/gruut_lang_*/espeak' -type d | \
|
||||
while read -r espeak_dir; do \
|
||||
rm -rf "${espeak_dir}"; \
|
||||
done
|
||||
|
||||
# Copy convenience scripts
|
||||
COPY pyinstaller/mimic3-server \
|
||||
pyinstaller/mimic3-download \
|
||||
dist/mimic3/
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=build /build/mimic3/dist/ /
|
||||
|
|
@ -43,6 +43,8 @@ RUN --mount=type=cache,id=apt-build,target=/var/cache/apt \
|
|||
|
||||
WORKDIR /build/mimic3
|
||||
|
||||
COPY wheels/ ./wheels/
|
||||
|
||||
COPY opentts-abc/ ./opentts-abc/
|
||||
COPY mimic3-http/ ./mimic3-http/
|
||||
COPY mimic3-tts/ ./mimic3-tts/
|
||||
|
|
@ -50,7 +52,6 @@ COPY install.sh ./
|
|||
|
||||
# Install mimic3
|
||||
RUN --mount=type=cache,id=pip-venv,target=/root/.cache/pip \
|
||||
PIP_INSTALL='install -f https://synesthesiam.github.io/prebuilt-apps/' \
|
||||
./install.sh
|
||||
|
||||
# Install PyInstaller
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
!tests/apope_sample.txt
|
||||
!tests/apope_sample_*.wav
|
||||
!voices/
|
||||
!wheels/
|
||||
|
||||
# Debian packaging
|
||||
!debian/control.in
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ RUN --mount=type=cache,id=apt-build,target=/var/cache/apt \
|
|||
|
||||
WORKDIR /build/mimic3
|
||||
|
||||
COPY wheels/ ./wheels/
|
||||
|
||||
COPY opentts-abc/ ./opentts-abc/
|
||||
COPY mimic3-http/ ./mimic3-http/
|
||||
COPY mimic3-tts/ ./mimic3-tts/
|
||||
|
|
@ -65,6 +67,8 @@ RUN --mount=type=cache,id=apt-run,target=/var/cache/apt \
|
|||
|
||||
WORKDIR /test
|
||||
|
||||
COPY wheels/ ./wheels/
|
||||
|
||||
COPY --from=build /build/mimic3/dist/*.tar.gz ./dist/
|
||||
|
||||
# Install mimic3 using source distribution
|
||||
|
|
@ -72,6 +76,7 @@ RUN --mount=type=cache,id=pip-requirements,target=/root/.cache/pip \
|
|||
python3 -m venv .venv && \
|
||||
.venv/bin/pip3 install \
|
||||
-f https://synesthesiam.github.io/prebuilt-apps/ \
|
||||
-f https://www.piwheels.hostedpi.com/simple/numpy/ \
|
||||
-f dist/ \
|
||||
mimic3-tts
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
!tests/apope_sample.txt
|
||||
!tests/apope_sample_*.wav
|
||||
!voices/
|
||||
!wheels/
|
||||
|
||||
# opentts-abc
|
||||
!opentts-abc/setup.py
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
!tests/apope_sample.txt
|
||||
!tests/apope_sample_*.wav
|
||||
!voices/
|
||||
!wheels/
|
||||
|
||||
# opentts-abc
|
||||
!opentts-abc/setup.py
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ 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
|
||||
|
|
|
|||
|
|
@ -34,11 +34,12 @@ 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
|
||||
|
||||
COPY wheels/ ./wheels/
|
||||
|
||||
COPY opentts-abc/ ./opentts-abc/
|
||||
COPY mimic3-http/ ./mimic3-http/
|
||||
COPY mimic3-tts/ ./mimic3-tts/
|
||||
|
|
@ -46,7 +47,6 @@ COPY install.sh ./
|
|||
|
||||
# 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
|
||||
|
||||
# Download default voice
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
!install.sh
|
||||
!tests/apope_sample.txt
|
||||
!voices/
|
||||
!wheels/
|
||||
|
||||
# opentts-abc
|
||||
!opentts-abc/setup.py
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -19,7 +19,7 @@ SHELL := bash
|
|||
|
||||
# linux/amd64,linux/arm64,linux/arm/v7
|
||||
DOCKER_PLATFORM ?= linux/amd64
|
||||
DOCKER_OUTPUT ?= --load
|
||||
DOCKER_OUTPUT ?=
|
||||
DOCKER_TAG ?= mycroftai/mimic3
|
||||
|
||||
# Build source distributions for PyPI.
|
||||
|
|
|
|||
2
debian/control.in
vendored
2
debian/control.in
vendored
|
|
@ -2,7 +2,7 @@ Package: mimic3-tts
|
|||
Version: ${VERSION}
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Depends: libespeak-ng1 libatomic1 libgomp1
|
||||
Depends: libespeak-ng1,libatomic1,libgomp1
|
||||
Recommends: sox
|
||||
Architecture: ${DEBIAN_ARCH}
|
||||
Maintainer: Mycroft AI
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ this_dir="$( cd "$( dirname "$0" )" && pwd )"
|
|||
: "${PYTHON=python3}"
|
||||
|
||||
# pip install command
|
||||
: "${PIP_INSTALL=install}"
|
||||
if [ -z "${PIP_INSTALL}" ]; then
|
||||
PIP_INSTALL="install -f "${this_dir}/wheels""
|
||||
fi
|
||||
|
||||
python_version="$(${PYTHON} --version)"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue