From 49a6f6f5d589702ed5b86ceadc23344c56064d04 Mon Sep 17 00:00:00 2001 From: Yuto Ashida Date: Sun, 6 Nov 2022 10:33:00 +0900 Subject: [PATCH] =?UTF-8?q?PyInstaller:=20Dockerfile=E3=81=8B=E3=82=89?= =?UTF-8?q?=E3=83=93=E3=83=AB=E3=83=89=E9=96=A2=E9=80=A3=E3=81=AE=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=82=92=E5=89=8A=E9=99=A4=20(#484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * remove build-env from docker file * remove nuitka build issue --- Dockerfile | 125 ----------------------------------------------------- 1 file changed, 125 deletions(-) diff --git a/Dockerfile b/Dockerfile index 793ef83de..d2f8e3522 100644 --- a/Dockerfile +++ b/Dockerfile @@ -185,9 +185,6 @@ COPY --from=compile-python-env /opt/python /opt/python ADD ./requirements.txt /tmp/ RUN <=60.7.0 - # https://github.com/Nuitka/Nuitka/issues/1406 - gosu user /opt/python/bin/python3 -m pip install --upgrade pip setuptools==60.6.0 wheel gosu user /opt/python/bin/pip3 install -r /tmp/requirements.txt EOF @@ -272,125 +269,3 @@ CMD [ "gosu", "user", "/opt/python/bin/python3", "./run.py", "--voicelib_dir", " # 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" ] - -# Binary build environment (common to CPU, GPU) -FROM runtime-env AS build-env - -# Install ccache for Nuitka cache -# chrpath: required for nuitka build; 'RPATH' settings in used shared -RUN < /opt/voicevox_engine/engine_manifest_assets/dependency_licenses.json - # FIXME: VOICEVOX (editor) cannot build without licenses.json - cp /opt/voicevox_engine/engine_manifest_assets/dependency_licenses.json /opt/voicevox_engine/licenses.json -EOF - -# Create build script -RUN < /build.sh - #!/bin/bash - set -eux - - # chown general user c.z. mounted directory may be owned by root - mkdir -p /opt/voicevox_engine_build - chown -R user:user /opt/voicevox_engine_build - - mkdir -p /home/user/.cache/Nuitka - chown -R user:user /home/user/.cache/Nuitka - - cd /opt/voicevox_engine_build - - gosu user /opt/python/bin/python3 -m nuitka \ - --output-dir=/opt/voicevox_engine_build \ - --standalone \ - --plugin-enable=numpy \ - --plugin-enable=multiprocessing \ - --follow-import-to=numpy \ - --follow-import-to=aiofiles \ - --include-package=uvicorn \ - --include-package=anyio \ - --include-package-data=pyopenjtalk \ - --include-package-data=scipy \ - --include-data-file=/opt/voicevox_engine/licenses.json=./ \ - --include-data-file=/opt/voicevox_engine/presets.yaml=./ \ - --include-data-file=/opt/voicevox_engine/default.csv=./ \ - --include-data-file=/opt/voicevox_engine/engine_manifest.json=./ \ - --include-data-file=/opt/voicevox_core/*.so=./ \ - --include-data-file=/opt/onnxruntime/lib/libonnxruntime.so=./ \ - --include-data-dir=/opt/voicevox_engine/speaker_info=./speaker_info \ - --include-data-dir=/opt/voicevox_engine/engine_manifest_assets=./engine_manifest_assets \ - --follow-imports \ - --no-prefer-source-code \ - /opt/voicevox_engine/run.py - - # Copy libonnxruntime_providers_cuda.so and dependencies (CUDA/cuDNN) - if [ -f "/opt/onnxruntime/lib/libonnxruntime_providers_cuda.so" ]; then - mkdir -p /tmp/coredeps - - # Copy provider libraries (libonnxruntime.so.{version} is copied by Nuitka) - cd /opt/onnxruntime/lib - cp libonnxruntime_*.so /tmp/coredeps/ - cd - - - # assert nvidia/cuda base image - cd /usr/local/cuda/lib64 - cp libcublas.so.* libcublasLt.so.* libcudart.so.* libcufft.so.* libcurand.so.* /tmp/coredeps/ - cd - - - # remove unneed full version libraries - cd /tmp/coredeps - rm -f libcublas.so.*.* libcublasLt.so.*.* libcufft.so.*.* libcurand.so.*.* - rm -f libcudart.so.*.*.* - cd - - - # assert nvidia/cuda base image - cd /usr/lib/x86_64-linux-gnu - cp libcudnn.so.* libcudnn_*_infer.so.* /tmp/coredeps/ - cd - - - # remove unneed full version libraries - cd /tmp/coredeps - rm -f libcudnn.so.*.* libcudnn_*_infer.so.*.* - cd - - - mv /tmp/coredeps/* /opt/voicevox_engine_build/run.dist/ - rm -rf /tmp/coredeps - fi - - chmod +x /opt/voicevox_engine_build/run.dist/run -EOD - chmod +x /build.sh -EOF - -CMD [ "bash", "/build.sh" ]