diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index c24a58b3f..55a402c12 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -24,9 +24,12 @@ jobs: - cpu-ubuntu20.04 - nvidia - nvidia-ubuntu20.04 + - cpu-ubuntu18.04 + - nvidia-ubuntu18.04 voicevox_core_version: [0.6.0] voicevox_core_example_version: [0.6.0] include: + # Ubuntu 20.04 - tag: '' target: runtime-env base_image: ubuntu:focal @@ -57,6 +60,21 @@ jobs: base_runtime_image: nvidia/cuda:11.4.1-cudnn8-runtime-ubuntu20.04 voicevox_core_library_name: core libtorch_url: https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcu111.zip + # Ubuntu 18.04 + - tag: cpu-ubuntu18.04 + target: runtime-env + base_image: ubuntu:bionic + base_runtime_image: ubuntu:bionic + voicevox_core_library_name: core_cpu + libtorch_url: https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcpu.zip + use_glibc_231_workaround: 1 + - tag: nvidia-ubuntu18.04 + target: runtime-nvidia-env + base_image: ubuntu:bionic + base_runtime_image: nvidia/cuda:11.4.1-cudnn8-runtime-ubuntu18.04 + voicevox_core_library_name: core + libtorch_url: https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcu111.zip + use_glibc_231_workaround: 1 steps: - uses: actions/checkout@v2 @@ -94,6 +112,7 @@ jobs: VOICEVOX_CORE_EXAMPLE_VERSION=${{ matrix.voicevox_core_example_version }} VOICEVOX_CORE_LIBRARY_NAME=${{ matrix.voicevox_core_library_name }} LIBTORCH_URL=${{ matrix.libtorch_url }} + USE_GLIBC_231_WORKAROUND=${{ matrix.use_glibc_231_workaround || '0' }} target: ${{ matrix.target }} push: true tags: | diff --git a/Dockerfile b/Dockerfile index a5fbd29f6..a934e2136 100644 --- a/Dockerfile +++ b/Dockerfile @@ -145,7 +145,6 @@ WORKDIR /opt/voicevox_engine # libsndfile1: soundfile shared object # ca-certificates: pyopenjtalk dictionary download # build-essential: pyopenjtalk local build -# parallel: retry download pyopenjtalk dictionary RUN < /dev/stderr -exec "\$@" -EOF - RUN < /dev/stderr + +# Workaround: ldconfig fail to load LibTorch if glibc < 2.31. +# For isolating problems and simplifing script, use flag USE_GLIBC_231_WORKAROUND +# instead of implementing version check logic. +if [ "${USE_GLIBC_231_WORKAROUND}" = "1" ]; then + export LD_LIBRARY_PATH="/opt/libtorch/lib:\${LD_LIBRARY_PATH:-}" +fi + +exec "\$@" EOF ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/Makefile b/Makefile index b99a72916..ae4b90ea5 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ CMD= -.PHONY: build-linux-docker-ubuntu -build-linux-docker-ubuntu: +# Ubuntu 20.04 +.PHONY: build-linux-docker-ubuntu20.04 +build-linux-docker-ubuntu20.04: docker buildx build . \ -t hiroshiba/voicevox_engine:cpu-ubuntu20.04-latest \ --target runtime-env \ @@ -11,14 +12,14 @@ build-linux-docker-ubuntu: --build-arg LIBTORCH_URL=https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcpu.zip \ --build-arg VOICEVOX_CORE_LIBRARY_NAME=core_cpu -.PHONY: run-linux-docker-ubuntu -run-linux-docker-ubuntu: +.PHONY: run-linux-docker-ubuntu20.04 +run-linux-docker-ubuntu20.04: docker run --rm -it \ -p '127.0.0.1:50021:50021' \ hiroshiba/voicevox_engine:cpu-ubuntu20.04-latest $(CMD) -.PHONY: build-linux-docker-nvidia -build-linux-docker-nvidia: +.PHONY: build-linux-docker-nvidia-ubuntu20.04 +build-linux-docker-nvidia-ubuntu20.04: docker buildx build . \ -t hiroshiba/voicevox_engine:nvidia-ubuntu20.04-latest \ --target runtime-nvidia-env \ @@ -28,13 +29,54 @@ build-linux-docker-nvidia: --build-arg LIBTORCH_URL=https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcu111.zip \ --build-arg VOICEVOX_CORE_LIBRARY_NAME=core -.PHONY: run-linux-docker-nvidia -run-linux-docker-nvidia: +.PHONY: run-linux-docker-nvidia-ubuntu20.04 +run-linux-docker-nvidia-ubuntu20.04: docker run --rm -it \ --gpus all \ -p '127.0.0.1:50021:50021' \ hiroshiba/voicevox_engine:nvidia-ubuntu20.04-latest $(CMD) + +# Ubuntu 18.04 +.PHONY: build-linux-docker-ubuntu18.04 +build-linux-docker-ubuntu18.04: + docker buildx build . \ + -t hiroshiba/voicevox_engine:cpu-ubuntu18.04-latest \ + --target runtime-env \ + --progress plain \ + --build-arg BASE_IMAGE=ubuntu:bionic \ + --build-arg BASE_RUNTIME_IMAGE=ubuntu:bionic \ + --build-arg LIBTORCH_URL=https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcpu.zip \ + --build-arg VOICEVOX_CORE_LIBRARY_NAME=core_cpu \ + --build-arg USE_GLIBC_231_WORKAROUND=1 + +.PHONY: run-linux-docker-ubuntu18.04 +run-linux-docker-ubuntu18.04: + docker run --rm -it \ + -p '127.0.0.1:50021:50021' \ + hiroshiba/voicevox_engine:cpu-ubuntu18.04-latest $(CMD) + +.PHONY: build-linux-docker-nvidia-ubuntu18.04 +build-linux-docker-nvidia-ubuntu18.04: + docker buildx build . \ + -t hiroshiba/voicevox_engine:nvidia-ubuntu18.04-latest \ + --target runtime-nvidia-env \ + --progress plain \ + --build-arg BASE_IMAGE=ubuntu:bionic \ + --build-arg BASE_RUNTIME_IMAGE=nvidia/cuda:11.4.1-cudnn8-runtime-ubuntu18.04 \ + --build-arg LIBTORCH_URL=https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcu111.zip \ + --build-arg VOICEVOX_CORE_LIBRARY_NAME=core \ + --build-arg USE_GLIBC_231_WORKAROUND=1 + +.PHONY: run-linux-docker-nvidia-ubuntu18.04 +run-linux-docker-nvidia-ubuntu18.04: + docker run --rm -it \ + --gpus all \ + -p '127.0.0.1:50021:50021' \ + hiroshiba/voicevox_engine:nvidia-ubuntu18.04-latest $(CMD) + + +# Python env for test .PHONY: build-linux-docker-compile-python-env build-linux-docker-compile-python-env: docker buildx build . \ @@ -48,6 +90,7 @@ run-linux-docker-compile-python-env: docker run --rm -it \ hiroshiba/voicevox_engine:compile-python-env $(CMD) + # Build linux binary in Docker .PHONY: build-linux-docker-build build-linux-docker-build: