Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: DockerHub で提供されているイメージに arm 版を追加 #639

Merged
merged 4 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,49 +42,52 @@ jobs:
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
onnxruntime_version: 1.13.1
platforms: linux/amd64,linux/arm64/v8
- tag: cpu
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
onnxruntime_version: 1.13.1
platforms: linux/amd64,linux/arm64/v8
- tag: cpu-ubuntu20.04
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
onnxruntime_version: 1.13.1
platforms: linux/amd64,linux/arm64/v8
- tag: nvidia
target: runtime-nvidia-env
base_image: ubuntu:20.04
base_runtime_image: nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04
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
onnxruntime_version: 1.13.1
platforms: linux/amd64
- tag: nvidia-ubuntu20.04
target: runtime-nvidia-env
base_image: ubuntu:20.04
base_runtime_image: nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04
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
onnxruntime_version: 1.13.1
platforms: linux/amd64
# Ubuntu 18.04
- tag: cpu-ubuntu18.04
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.13.1/onnxruntime-linux-x64-1.13.1.tgz
onnxruntime_version: 1.13.1
platforms: linux/amd64,linux/arm64/v8
- tag: nvidia-ubuntu18.04
target: runtime-nvidia-env
base_image: ubuntu:18.04
base_runtime_image: nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu18.04
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
onnxruntime_version: 1.13.1
platforms: linux/amd64

steps:
- uses: actions/checkout@v3

- name: Setup QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
Expand Down Expand Up @@ -128,7 +131,6 @@ 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 @@ -138,12 +140,13 @@ 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 }}
ONNXRUNTIME_URL=${{ matrix.onnxruntime_url }}
USE_GPU=${{ matrix.target == 'runtime-nvidia-env' }}
ONNXRUNTIME_VERSION=${{ matrix.onnxruntime_version }}
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
platforms: ${{ matrix.platforms }}
40 changes: 38 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,29 @@ RUN <<EOF
EOF

# assert VOICEVOX_CORE_VERSION >= 0.11.0 (ONNX)
ARG VOICEVOX_CORE_ASSET_PREFIX=voicevox_core-linux-x64-cpu
ARG TARGETPLATFORM
ARG USE_GPU=false
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 @@ -64,10 +82,28 @@ RUN <<EOF
rm -rf /var/lib/apt/lists/*
EOF

ARG ONNXRUNTIME_URL=https://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-1.13.1.tgz
ARG TARGETPLATFORM
ARG USE_GPU=false
ARG ONNXRUNTIME_VERSION=1.13.1
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