From b41ce0569d8b49c6cfea8da91fdd998229667195 Mon Sep 17 00:00:00 2001 From: k-shir0 Date: Tue, 28 Mar 2023 05:45:57 +0900 Subject: [PATCH] =?UTF-8?q?add:=20=E3=81=9D=E3=82=8C=E3=81=9E=E3=82=8C?= =?UTF-8?q?=E3=81=AE=E3=82=A2=E3=83=BC=E3=82=AD=E3=83=86=E3=82=AF=E3=83=81?= =?UTF-8?q?=E3=83=A3=E3=81=A7=E3=83=93=E3=83=AB=E3=83=89=E3=81=97=E3=81=9D?= =?UTF-8?q?=E3=82=8C=E3=82=92=E7=B5=B1=E5=90=88=E3=81=99=E3=82=8B=E5=BD=A2?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-docker.yml | 180 ++++++++++++++++++++++++++--- Dockerfile | 40 +------ 2 files changed, 166 insertions(+), 54 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index ab7158a45..a0b59bd5c 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -36,50 +36,106 @@ jobs: - nvidia-ubuntu20.04 - cpu-ubuntu18.04 - nvidia-ubuntu18.04 + tag_platform_prefix: + - amd64 + - arm64 + exclude: + - tag: nvidia + tag_platform_prefix: arm64 + - tag: nvidia-ubuntu20.04 + tag_platform_prefix: arm64 + - tag: nvidia-ubuntu18.04 + tag_platform_prefix: arm64 include: # Ubuntu 20.04 - tag: "" + tag_platform_prefix: amd64 target: runtime-env base_image: ubuntu:20.04 base_runtime_image: ubuntu:20.04 - onnxruntime_version: 1.13.1 - platforms: linux/amd64,linux/arm64/v8 + voicevox_core_asset_prefix: voicevox_core-linux-x64-cpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-1.13.1.tgz + platforms: linux/amd64 + - tag: "" + tag_platform_prefix: arm64 + target: runtime-env + base_image: ubuntu:20.04 + base_runtime_image: ubuntu:20.04 + voicevox_core_asset_prefix: voicevox_core-linux-arm64-cpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.14.1/onnxruntime-linux-aarch64-1.14.1.tgz + platforms: linux/arm64/v8 + - tag: cpu + tag_platform_prefix: amd64 + target: runtime-env + base_image: ubuntu:20.04 + base_runtime_image: ubuntu:20.04 + voicevox_core_asset_prefix: voicevox_core-linux-x64-cpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-1.13.1.tgz + platforms: linux/amd64 - tag: cpu + tag_platform_prefix: arm64 target: runtime-env base_image: ubuntu:20.04 base_runtime_image: ubuntu:20.04 - onnxruntime_version: 1.13.1 - platforms: linux/amd64,linux/arm64/v8 + voicevox_core_asset_prefix: voicevox_core-linux-arm64-cpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.14.1/onnxruntime-linux-aarch64-1.14.1.tgz + platforms: linux/arm64/v8 - tag: cpu-ubuntu20.04 + tag_platform_prefix: amd64 target: runtime-env base_image: ubuntu:20.04 base_runtime_image: ubuntu:20.04 - onnxruntime_version: 1.13.1 - platforms: linux/amd64,linux/arm64/v8 + voicevox_core_asset_prefix: voicevox_core-linux-x64-cpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-1.13.1.tgz + platforms: linux/amd64 + - tag: cpu-ubuntu20.04 + tag_platform_prefix: arm64 + target: runtime-env + base_image: ubuntu:20.04 + base_runtime_image: ubuntu:20.04 + voicevox_core_asset_prefix: voicevox_core-linux-arm64-cpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.14.1/onnxruntime-linux-aarch64-1.14.1.tgz + platforms: linux/arm64/v8 - tag: nvidia + tag_platform_prefix: amd64 target: runtime-nvidia-env base_image: ubuntu:20.04 base_runtime_image: nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04 - onnxruntime_version: 1.13.1 + voicevox_core_asset_prefix: voicevox_core-linux-x64-gpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-gpu-1.13.1.tgz platforms: linux/amd64 - tag: nvidia-ubuntu20.04 + tag_platform_prefix: amd64 target: runtime-nvidia-env base_image: ubuntu:20.04 base_runtime_image: nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04 - onnxruntime_version: 1.13.1 + voicevox_core_asset_prefix: voicevox_core-linux-x64-gpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-gpu-1.13.1.tgz platforms: linux/amd64 # Ubuntu 18.04 - tag: cpu-ubuntu18.04 + tag_platform_prefix: amd64 target: runtime-env base_image: ubuntu:18.04 base_runtime_image: ubuntu:18.04 - onnxruntime_version: 1.13.1 - platforms: linux/amd64,linux/arm64/v8 + voicevox_core_asset_prefix: voicevox_core-linux-x64-cpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-1.13.1.tgz + platforms: linux/amd64 + - tag: cpu-ubuntu18.04 + tag_platform_prefix: arm64 + target: runtime-env + base_image: ubuntu:18.04 + base_runtime_image: ubuntu:18.04 + voicevox_core_asset_prefix: voicevox_core-linux-x64-cpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.14.1/onnxruntime-linux-aarch64-1.14.1.tgz + platforms: linux/arm64/v8 - tag: nvidia-ubuntu18.04 + tag_platform_prefix: amd64 target: runtime-nvidia-env base_image: ubuntu:18.04 base_runtime_image: nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu18.04 - onnxruntime_version: 1.13.1 + voicevox_core_asset_prefix: voicevox_core-linux-x64-gpu + onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-gpu-1.13.1.tgz platforms: linux/amd64 steps: @@ -131,6 +187,7 @@ jobs: format('{0}:{1}-{2}', env.IMAGE_NAME, matrix.tag, env.VOICEVOX_ENGINE_VERSION) ) || format('{0}:{1}', env.IMAGE_NAME, env.VOICEVOX_ENGINE_VERSION) ) }} + VOICEVOX_CORE_ASSET_NAME: ${{ matrix.voicevox_core_asset_prefix }}-${{ env.VOICEVOX_CORE_VERSION }} with: context: . builder: ${{ steps.buildx.outputs.name }} @@ -140,13 +197,104 @@ jobs: BASE_RUNTIME_IMAGE=${{ matrix.base_runtime_image }} PYTHON_VERSION=${{ env.PYTHON_VERSION }} VOICEVOX_ENGINE_VERSION=${{ env.VOICEVOX_ENGINE_VERSION }} + VOICEVOX_CORE_ASSET_NAME=${{ env.VOICEVOX_CORE_ASSET_NAME }} VOICEVOX_CORE_VERSION=${{ env.VOICEVOX_CORE_VERSION }} VOICEVOX_RESOURCE_VERSION=${{ env.VOICEVOX_RESOURCE_VERSION }} - USE_GPU=${{ matrix.target == 'runtime-nvidia-env' }} - ONNXRUNTIME_VERSION=${{ matrix.onnxruntime_version }} + ONNXRUNTIME_URL=${{ matrix.onnxruntime_url }} target: ${{ matrix.target }} push: true - tags: ${{ env.IMAGE_TAG }} - cache-from: type=registry,ref=${{ env.IMAGE_TAG }}-buildcache - cache-to: type=registry,ref=${{ env.IMAGE_TAG }}-buildcache,mode=max + tags: ${{ env.IMAGE_TAG }}-${{ matrix.tag_platform_prefix }} + cache-from: type=registry,ref=${{ env.IMAGE_TAG }}-${{ matrix.tag_platform_prefix }}-buildcache + cache-to: type=registry,ref=${{ env.IMAGE_TAG }}-${{ matrix.tag_platform_prefix }}-buildcache,mode=max platforms: ${{ matrix.platforms }} + + create-manifests: + runs-on: [ ubuntu-latest ] + needs: build-docker + + steps: + - uses: actions/checkout@v3 + + - name: Setup Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # Tag "" + - name: Create and push manifest for "" + env: + TAG: ${{ env.IMAGE_NAME }}:${{ env.VOICEVOX_ENGINE_VERSION }} + run: | + docker manifest create \ + ${{ env.TAG }} \ + --amend ${{ env.TAG }}-amd64 \ + --amend ${{ env.TAG }}-arm64 + docker manifest push ${{ env.TAG }} + + # Tag "cpu" + - name: Create and push manifest for "cpu" + env: + TAG: ${{ env.IMAGE_NAME }}:cpu-${{ env.VOICEVOX_ENGINE_VERSION }} + run: | + docker manifest create \ + ${{ env.TAG }} \ + --amend ${{ env.TAG }}-amd64 \ + --amend ${{ env.TAG }}-arm64 + docker manifest push ${{ env.TAG }} + + # Tag "cpu-ubuntu20.04" + - name: Create and push manifest for "cpu-ubuntu20.04" + env: + TAG: ${{ env.IMAGE_NAME }}:cpu-ubuntu20.04-${{ env.VOICEVOX_ENGINE_VERSION }} + run: | + docker manifest create \ + ${{ env.TAG }} \ + --amend ${{ env.TAG }}-amd64 \ + --amend ${{ env.TAG }}-arm64 + docker manifest push ${{ env.TAG }} + + # Tag "nvidia" + - name: Create and push manifest for "nvidia" + env: + TAG: ${{ env.IMAGE_NAME }}:nvidia-${{ env.VOICEVOX_ENGINE_VERSION }} + run: | + docker manifest create \ + ${{ env.TAG }} \ + --amend ${{ env.TAG }}-amd64 + docker manifest push ${{ env.TAG }} + + # Tag "nvidia-ubuntu20.04" + - name: Create and push manifest for "nvidia-ubuntu20.04" + env: + TAG: ${{ env.IMAGE_NAME }}:nvidia-ubuntu20.04-${{ env.VOICEVOX_ENGINE_VERSION }} + run: | + docker manifest create \ + ${{ env.TAG }} \ + --amend ${{ env.TAG }}-amd64 + docker manifest push ${{ env.TAG }} + + # Tag "cpu-ubuntu18.04" + - name: Create and push manifest for "cpu-ubuntu18.04" + env: + TAG: ${{ env.IMAGE_NAME }}:cpu-ubuntu18.04-${{ env.VOICEVOX_ENGINE_VERSION }} + run: | + docker manifest create \ + ${{ env.TAG }} \ + --amend ${{ env.TAG }}-amd64 \ + --amend ${{ env.TAG }}-arm64 + docker manifest push ${{ env.TAG }} + + # Tag "nvidia-ubuntu18.04" + - name: Create and push manifest for "nvidia-ubuntu18.04" + env: + TAG: ${{ env.IMAGE_NAME }}:nvidia-ubuntu18.04-${{ env.VOICEVOX_ENGINE_VERSION }} + run: | + docker manifest create \ + ${{ env.TAG }} \ + --amend ${{ env.TAG }}-amd64 + docker manifest push ${{ env.TAG }} diff --git a/Dockerfile b/Dockerfile index bbc9845af..38a55f5c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,29 +21,11 @@ RUN <= 0.11.0 (ONNX) -ARG TARGETPLATFORM -ARG USE_GPU=false +ARG VOICEVOX_CORE_ASSET_PREFIX=voicevox_core-linux-x64-cpu ARG VOICEVOX_CORE_VERSION=0.14.2 - RUN <