Skip to content

Commit 739a7ea

Browse files
qryxipHiroshiba
andauthored
build!: DockerではPyinstallerビルドのエンジンを用いる (#1669)
Co-authored-by: Hiroshiba <[email protected]>
1 parent ace1ede commit 739a7ea

File tree

7 files changed

+55
-299
lines changed

7 files changed

+55
-299
lines changed

.github/actions/prepare_python/action.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ inputs:
55
dependency-group:
66
description: "uv の依存パッケージインストール時に指定するグループ"
77
required: false
8-
outputs:
9-
python-version:
10-
description: "Python version"
11-
value: ${{ steps.export-python-version.outputs.python-version }}
128

139
runs:
1410
using: "composite"
@@ -26,12 +22,3 @@ runs:
2622
uv sync
2723
fi
2824
shell: bash
29-
30-
- name: <Deploy> Export Python version
31-
id: export-python-version
32-
run: |
33-
PYTHON_VERSION=$(
34-
uv run python -c 'import platform; print(platform.python_version())'
35-
)
36-
echo "python-version=${PYTHON_VERSION}" >> "$GITHUB_OUTPUT"
37-
shell: bash

.github/workflows/build-engine-container.yml

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ on:
33
# FIXME: デフォルトブランチへのpush時にビルドをテストする
44
# https://github.com/VOICEVOX/voicevox_engine/pull/1669#discussion_r2076730954
55
workflow_call:
6-
release:
7-
types:
8-
- created
6+
inputs:
7+
version:
8+
type: string
9+
required: true
910
workflow_dispatch:
1011
inputs:
1112
version:
@@ -15,8 +16,6 @@ on:
1516
env:
1617
IMAGE_NAME: ${{ vars.DOCKERHUB_USERNAME }}/voicevox_engine
1718
VOICEVOX_RESOURCE_VERSION: "0.23.0"
18-
VOICEVOX_CORE_VERSION: "0.15.7"
19-
ONNXRUNTIME_VERSION: "1.13.1"
2019

2120
defaults:
2221
run:
@@ -45,8 +44,7 @@ jobs:
4544
# prefixes: Docker tagのプレフィックス。カンマ区切り。空文字列の場合、バージョン文字列のみがタグ名になる
4645
# buildcache_prefix: ビルドキャッシュのプレフィックス。空文字列やカンマは使用不可
4746
# target: Dockerfileのビルドステージ名
48-
# base_image: Dockerfileのビルド用ステージのベースイメージ
49-
# base_runtime_image: Dockerfileの実行用ステージのベースイメージ
47+
# base_image: Dockerfileのベースイメージ
5048
# platforms: Dockerのプラットフォームバリアント。カンマ区切り。 参考: https://docs.docker.com/build/building/multi-platform/
5149
include:
5250
# Ubuntu 20.04 / AMD64
@@ -55,55 +53,54 @@ jobs:
5553
buildcache_prefix: "cpu-amd64-ubuntu20.04"
5654
target: runtime-env
5755
base_image: mirror.gcr.io/ubuntu:20.04
58-
base_runtime_image: mirror.gcr.io/ubuntu:20.04
56+
voicevox_engine_target: linux-cpu-x64
5957
platforms: linux/amd64
6058
# Ubuntu 20.04 / ARM64
6159
- os: ubuntu-24.04-arm
6260
prefixes: "cpu-arm64-ubuntu20.04"
6361
buildcache_prefix: "cpu-arm64-ubuntu20.04"
6462
target: runtime-env
6563
base_image: mirror.gcr.io/ubuntu:20.04
66-
base_runtime_image: mirror.gcr.io/ubuntu:20.04
64+
voicevox_engine_target: linux-cpu-arm64
6765
platforms: linux/arm64/v8
6866
# Ubuntu 20.04 / AMD64 / NVIDIA
6967
- os: ubuntu-latest
7068
prefixes: "nvidia-ubuntu20.04,nvidia-amd64-ubuntu20.04"
7169
buildcache_prefix: "nvidia-amd64-ubuntu20.04"
7270
target: runtime-nvidia-env
7371
base_image: mirror.gcr.io/ubuntu:20.04
74-
base_runtime_image: mirror.gcr.io/nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04
72+
voicevox_engine_target: linux-nvidia
7573
platforms: linux/amd64
7674
# Ubuntu 22.04 / AMD64
7775
- os: ubuntu-latest
7876
prefixes: "cpu-amd64,cpu-amd64-ubuntu22.04"
7977
buildcache_prefix: "cpu-amd64-ubuntu22.04"
8078
target: runtime-env
8179
base_image: mirror.gcr.io/ubuntu:22.04
82-
base_runtime_image: mirror.gcr.io/ubuntu:22.04
80+
voicevox_engine_target: linux-cpu-x64
8381
platforms: linux/amd64
8482
# Ubuntu 22.04 / ARM64
8583
- os: ubuntu-24.04-arm
8684
prefixes: "cpu-arm64,cpu-arm64-ubuntu22.04"
8785
buildcache_prefix: "cpu-arm64-ubuntu22.04"
8886
target: runtime-env
8987
base_image: mirror.gcr.io/ubuntu:22.04
90-
base_runtime_image: mirror.gcr.io/ubuntu:22.04
88+
voicevox_engine_target: linux-cpu-arm64
9189
platforms: linux/arm64/v8
9290
# Ubuntu 22.04 / AMD64 / NVIDIA
9391
- os: ubuntu-latest
9492
prefixes: "nvidia,nvidia-amd64,nvidia-ubuntu22.04,nvidia-amd64-ubuntu22.04"
9593
buildcache_prefix: "nvidia-amd64-ubuntu22.04"
9694
target: runtime-nvidia-env
9795
base_image: mirror.gcr.io/ubuntu:22.04
98-
base_runtime_image: mirror.gcr.io/nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
96+
voicevox_engine_target: linux-nvidia
9997
platforms: linux/amd64
10098

10199
steps:
102100
- name: <Setup> Check out the repository
103101
uses: actions/checkout@v4
104102

105-
- name: <Setup> Prepare Python version
106-
id: prepare-python
103+
- name: <Setup> Prepare Python
107104
uses: ./.github/actions/prepare_python
108105

109106
- name: <Setup> Set up Docker Buildx
@@ -116,26 +113,6 @@ jobs:
116113
username: ${{ vars.DOCKERHUB_USERNAME }}
117114
password: ${{ secrets.DOCKERHUB_TOKEN }}
118115

119-
- name: <Setup> Prepare VOICEVOX RESOURCE cache
120-
uses: actions/cache@v4
121-
id: voicevox-resource-cache
122-
with:
123-
key: voicevox-resource-${{ env.VOICEVOX_RESOURCE_VERSION }}
124-
path: download/resource
125-
126-
- name: <Setup> Check out the VOICEVOX RESOURCE repository
127-
if: steps.voicevox-resource-cache.outputs.cache-hit != 'true'
128-
uses: actions/checkout@v4
129-
with:
130-
repository: VOICEVOX/voicevox_resource
131-
ref: ${{ env.VOICEVOX_RESOURCE_VERSION }}
132-
path: download/resource
133-
134-
- name: <Build> Merge VOICEVOX RESOURCE
135-
env:
136-
DOWNLOAD_RESOURCE_PATH: download/resource
137-
run: bash tools/process_voicevox_resource.bash
138-
139116
- name: <Build> Generate Docker image names
140117
id: generate-docker-image-names
141118
run: |
@@ -181,13 +158,9 @@ jobs:
181158
file: ./Dockerfile
182159
build-args: |
183160
BASE_IMAGE=${{ matrix.base_image }}
184-
BASE_RUNTIME_IMAGE=${{ matrix.base_runtime_image }}
185-
PYTHON_VERSION=${{ steps.prepare-python.outputs.python-version }}
186161
VOICEVOX_ENGINE_VERSION=${{ needs.config.outputs.version }}
187-
VOICEVOX_CORE_VERSION=${{ env.VOICEVOX_CORE_VERSION }}
162+
VOICEVOX_ENGINE_TARGET=${{ matrix.voicevox_engine_target }}
188163
VOICEVOX_RESOURCE_VERSION=${{ env.VOICEVOX_RESOURCE_VERSION }}
189-
USE_GPU=${{ matrix.target == 'runtime-nvidia-env' }}
190-
ONNXRUNTIME_VERSION=${{ env.ONNXRUNTIME_VERSION }}
191164
target: ${{ matrix.target }}
192165
push: true
193166
tags: ${{ steps.generate-docker-image-names.outputs.tags }}
@@ -215,8 +188,7 @@ jobs:
215188
- name: <Setup> Check out the repository
216189
uses: actions/checkout@v4
217190

218-
- name: <Setup> Prepare Python version
219-
id: prepare-python
191+
- name: <Setup> Prepare Python
220192
uses: ./.github/actions/prepare_python
221193

222194
- name: <Setup> Set up Docker Buildx

.github/workflows/build-engine-package.yml renamed to .github/workflows/build-engine.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,3 +662,10 @@ jobs:
662662
with:
663663
version: ${{ needs.config.outputs.version }}
664664
repo_url: ${{ format('{0}/{1}', github.server_url, github.repository) }} # このリポジトリのURL
665+
666+
run-build-engine-container-workflow:
667+
if: needs.config.outputs.version != ''
668+
needs: [config, run-release-test-workflow]
669+
uses: ./.github/workflows/build-engine-container.yml
670+
with:
671+
version: ${{ needs.config.outputs.version }}

.github/workflows/build-latest-dev.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,11 @@ jobs:
3030
github.rest.actions.createWorkflowDispatch({
3131
owner: context.repo.owner,
3232
repo: context.repo.repo,
33-
workflow_id: 'build-engine-package.yml',
33+
workflow_id: 'build-engine.yml',
3434
ref: 'master',
3535
inputs: {
3636
version: dev_version,
3737
prerelease: true,
3838
},
3939
});
40-
github.rest.actions.createWorkflowDispatch({
41-
owner: context.repo.owner,
42-
repo: context.repo.repo,
43-
workflow_id: 'build-engine-container.yml',
44-
ref: 'master',
45-
inputs: {
46-
version: dev_version,
47-
},
48-
});
4940
console.log(`Triggered workflow_dispatch for ${dev_version}`);

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ uv lock --upgrade # 全部更新
248248

249249
#### パッケージ情報を pip requirements.txt ファイルへ反映する
250250

251-
Docker 用に requirements.txt ファイルを用意しています。
251+
pip-audit のために requirements.txt ファイルを用意しています。
252252

253253
```bash
254254
uv export --no-annotate --no-hashes --no-header -o requirements.txt # こちらを更新する場合は下2つも更新する必要があります。
@@ -361,7 +361,7 @@ TODO: Docker 版のビルド手順を GitHub Actions をベースに記述する
361361

362362
### Github Actions でビルド
363363

364-
fork したリポジトリで Actions を ON にし、workflow_dispatch で`build-engine-package.yml`を起動すればビルドできます。
364+
fork したリポジトリで Actions を ON にし、workflow_dispatch で`build-engine.yml`を起動すればビルドできます。
365365
成果物は Release にアップロードされます。
366366

367367
### API ドキュメントの確認

0 commit comments

Comments
 (0)