From 49816e0ebc9b7247c537309e2d36db196f452ddf Mon Sep 17 00:00:00 2001 From: MG8853 Date: Sun, 14 Apr 2024 22:45:17 +0900 Subject: [PATCH] =?UTF-8?q?voicevox=E7=94=A8=E3=83=86=E3=82=B9=E3=83=88no3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VOICEVOX_engine/Dockerfile | 287 ++++++++++++++++++++++++++++++---- VOICEVOX_engine/entrypoint.sh | 3 + 2 files changed, 263 insertions(+), 27 deletions(-) diff --git a/VOICEVOX_engine/Dockerfile b/VOICEVOX_engine/Dockerfile index 66aca8e..d0ae132 100644 --- a/VOICEVOX_engine/Dockerfile +++ b/VOICEVOX_engine/Dockerfile @@ -1,31 +1,134 @@ -FROM --platform=$TARGETOS/$TARGETARCH python:3.11-bookworm +# syntax=docker/dockerfile:1.4 -ENV DEBIAN_FRONTEND=noninteractive +ARG BASE_IMAGE=ubuntu:20.04 +ARG BASE_RUNTIME_IMAGE=$BASE_IMAGE -RUN apt-get update -y \ - && apt-get install -y \ - sudo \ +# Download VOICEVOX Core shared object +FROM --platform=$TARGETOS/$TARGETARCH ${BASE_IMAGE} AS download-core-env +ARG DEBIAN_FRONTEND=noninteractive + +WORKDIR /work + +RUN <= 0.11.0 (ONNX) +ARG TARGETPLATFORM +ARG USE_GPU=false +ARG VOICEVOX_CORE_VERSION=0.15.3 + +RUN < /etc/ld.so.conf.d/voicevox_core.conf + + # Update dynamic library search cache + ldconfig +EOF + + +# Download ONNX Runtime +FROM --platform=$TARGETOS/$TARGETARCH ${BASE_IMAGE} AS download-onnxruntime-env +ARG DEBIAN_FRONTEND=noninteractive + +WORKDIR /work + +RUN < /etc/ld.so.conf.d/onnxruntime.conf + + # Update dynamic library search cache + ldconfig +EOF + + +# Compile Python (version locked) +FROM --platform=$TARGETOS/$TARGETARCH ${BASE_IMAGE} AS compile-python-env + +ARG DEBIAN_FRONTEND=noninteractive + +RUN < /etc/profile.d/python-path.sh +# echo "export LD_LIBRARY_PATH=/opt/python/lib:\$LD_LIBRARY_PATH" >> /etc/profile.d/python-path.sh +# echo "export C_INCLUDE_PATH=/opt/python/include:\$C_INCLUDE_PATH" >> /etc/profile.d/python-path.sh +# +# rm -f /etc/ld.so.cache +# ldconfig +# EOF + + +# Runtime +FROM --platform=$TARGETOS/$TARGETARCH ${BASE_RUNTIME_IMAGE} AS runtime-env +ARG DEBIAN_FRONTEND=noninteractive + +WORKDIR /opt/voicevox_engine + +# ca-certificates: pyopenjtalk dictionary download +# build-essential: pyopenjtalk local build +# libsndfile1: soundfile shared object for arm64 +# ref: https://github.com/VOICEVOX/voicevox_engine/issues/770 +RUN < /opt/voicevox_engine/engine_manifest_assets/dependency_licenses.json + cp /opt/voicevox_engine/engine_manifest_assets/dependency_licenses.json /opt/voicevox_engine/licenses.json +EOF + +# Keep this layer separated to use layer cache on download failed in local build +RUN < /dev/stderr + # Replace Startup Variables MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g') echo ":/home/container$ ${MODIFIED_STARTUP}"