Skip to content

Commit

Permalink
add: それぞれのアーキテクチャでビルドしそれを統合する形に変更
Browse files Browse the repository at this point in the history
  • Loading branch information
K-shir0 committed Mar 28, 2023
1 parent 9da61cc commit b41ce05
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 54 deletions.
180 changes: 164 additions & 16 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}
40 changes: 2 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,11 @@ RUN <<EOF
EOF

# assert VOICEVOX_CORE_VERSION >= 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 <<EOF
set -eux

# Processing Switch
if [ "${USE_GPU}" = "true" ]; then
VOICEVOX_CORE_ASSET_ASSET_PROCESSING="gpu"
else
VOICEVOX_CORE_ASSET_ASSET_PROCESSING="cpu"
fi

# TARGETARCH Switch
if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then
VOICEVOX_CORE_ASSET_TARGETARCH="x64"
else
VOICEVOX_CORE_ASSET_TARGETARCH="arm64"
fi

VOICEVOX_CORE_ASSET_PREFIX="voicevox_core-linux-${VOICEVOX_CORE_ASSET_TARGETARCH}-${VOICEVOX_CORE_ASSET_ASSET_PROCESSING}"

# Download Core
VOICEVOX_CORE_ASSET_NAME=${VOICEVOX_CORE_ASSET_PREFIX}-${VOICEVOX_CORE_VERSION}
wget -nv --show-progress -c -O "./${VOICEVOX_CORE_ASSET_NAME}.zip" "https://github.com/VOICEVOX/voicevox_core/releases/download/${VOICEVOX_CORE_VERSION}/${VOICEVOX_CORE_ASSET_NAME}.zip"
Expand Down Expand Up @@ -82,28 +64,10 @@ RUN <<EOF
rm -rf /var/lib/apt/lists/*
EOF

ARG TARGETPLATFORM
ARG USE_GPU=false
ARG ONNXRUNTIME_VERSION=1.13.1
ARG ONNXRUNTIME_URL=https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-1.13.1.tgz
RUN <<EOF
set -eux

# Processing Switch
if [ "${USE_GPU}" = "true" ]; then
ONNXRUNTIME_PROCESSING="gpu-"
else
ONNXRUNTIME_PROCESSING=""
fi

# TARGETARCH Switch
if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then
ONNXRUNTIME_TARGETARCH=x64
else
ONNXRUNTIME_TARGETARCH=aarch64
fi

ONNXRUNTIME_URL="https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-linux-${ONNXRUNTIME_TARGETARCH}-${ONNXRUNTIME_PROCESSING}${ONNXRUNTIME_VERSION}.tgz"

# Download ONNX Runtime
wget -nv --show-progress -c -O "./onnxruntime.tgz" "${ONNXRUNTIME_URL}"

Expand Down

0 comments on commit b41ce05

Please sign in to comment.