# syntax=docker/dockerfile:1.4 ARG BASE_IMAGE=ubuntu:20.04 ARG BASE_RUNTIME_IMAGE=$BASE_IMAGE # Download VOICEVOX Core shared object FROM ${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.14.0 RUN < /etc/ld.so.conf.d/voicevox_core.conf # Update dynamic library search cache ldconfig EOF # Download ONNX Runtime FROM ${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 ${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 ${BASE_RUNTIME_IMAGE} AS runtime-env ARG DEBIAN_FRONTEND=noninteractive WORKDIR /opt/voicevox_engine # ca-certificates: pyopenjtalk dictionary download # build-essential: pyopenjtalk local build 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 exec "\$@" EOF ENTRYPOINT [ "/entrypoint.sh" ] CMD [ "gosu", "user", "/opt/python/bin/python3", "./run.py", "--voicelib_dir", "/opt/voicevox_core/", "--runtime_dir", "/opt/onnxruntime/lib", "--host", "0.0.0.0" ] # Enable use_gpu FROM runtime-env AS runtime-nvidia-env CMD [ "gosu", "user", "/opt/python/bin/python3", "./run.py", "--use_gpu", "--voicelib_dir", "/opt/voicevox_core/", "--runtime_dir", "/opt/onnxruntime/lib", "--host", "0.0.0.0" ]