Skip to content

build!: DockerではPyinstallerビルドのエンジンを用いる #1669

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

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

qryxip
Copy link
Member

@qryxip qryxip commented May 2, 2025

内容

関連 Issue

Resolves #1668

スクリーンショット・動画など

その他

@qryxip qryxip force-pushed the pr/build-use-pyinstaller-package-for-docker branch from 7dfc341 to dac6673 Compare May 2, 2025 10:34
@qryxip qryxip force-pushed the pr/build-use-pyinstaller-package-for-docker branch from dac6673 to f777833 Compare May 2, 2025 15:03
Copy link
Member Author

@qryxip qryxip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f777833 (#1669): download-engine-envを仕上げました。

Dockerfile Outdated
ARG VOICEVOX_ENGINE_VERSION=latest
ARG USE_GPU=false

RUN --mount=type=secret,id=gh-token,env=GH_TOKEN <<EOF
Copy link
Member Author

@qryxip qryxip May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 シェルスクリプトの書き方については、

  • インデントは4
  • (実質的に)定数となる変数は大文字

というところだけ合わせておく。

@qryxip
Copy link
Member Author

qryxip commented May 2, 2025

8ae5a76 (#1669): docker run -p 127.0.0.1:50021:50021までできるようにしました。

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

まだ完成じゃないかもですが気になるポイントをコメントしてみました!
かなり良い感じな気がしました!!!

判断メモ:
Github Runner側でパッケージをダウンロードして、dockerfileには COPY するだけという手もありそう。
でも今までは結構dockerfileの中でダウンロードしたりしていたので、そっちに合わせる手もありそう。
どちらが良いか今のところわからないので、個人的には一旦どっちでも良さそう!!

@Hiroshiba Hiroshiba requested a review from aoirint May 2, 2025 16:17
@Hiroshiba
Copy link
Member

現状draftですが、もしよかったら @aoirint さんからも気になる点があったらコメントいただけると・・・!! 🙏
(「こういう設計の方がいいんじゃないか」みたいなのって人それぞれで、いろんな人の視点を入れた方が良いものが出来上がる)

@qryxip
Copy link
Member Author

qryxip commented May 3, 2025

fd5ad27 (#1669): Docker内のTARGETPLATFORMはどうやらlinux/arm64/v8ではなくlinux/arm64になるっぽいので訂正。
74196e1 (#1669): GHA側をやりました。

これにより、

  1. Ubuntu 20.04を爆破する (Dockerのベースイメージにubuntu:20.04が使われている箇所への対応 #1559)
  2. VOICEVOX_ENGINE_VERSIONとしてlatestを受け入れるのをやめる

のどちらかをやればdraftを外せる状態になると思います。


ちなみにUbuntu 22.04のdocker buildまでなら動くことを確認しました。
https://github.com/qryxip/voicevox_engine/actions/runs/14806840981

@Hiroshiba
Copy link
Member

@aoirint さんのキャッシュに関してのコメントを見て、20.04を爆破するのも良さそうですが、その場合でもlatestは辞めたほうが良さそうだなと思いました!!
とりあえず20.04をどうするかは置いといて、2のlatestを辞める方向で進めるというのはどうでしょうか?

@qryxip
Copy link
Member Author

qryxip commented May 3, 2025

cce8419 (#1669)
10a6205 (#1669): latestの対応をやめました。

@qryxip qryxip force-pushed the pr/build-use-pyinstaller-package-for-docker branch from cce8419 to 10a6205 Compare May 3, 2025 10:20
@qryxip qryxip marked this pull request as ready for review May 3, 2025 10:34
@qryxip qryxip requested a review from a team as a code owner May 3, 2025 10:34
@qryxip qryxip requested review from Hiroshiba and removed request for a team May 3, 2025 10:34
Copy link
Member Author

@qryxip qryxip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6a042f9 (#1669): README.mdとCONTRIBUTING.mdを更新

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

僕的にはほぼLGTMです!!

@aoirint さん的に想像と違ってるとことかあればぜひコメントいただければという感じです!!
(あと #1662 の兼ね合いとかでもコメントあれば!!)

@@ -15,8 +14,6 @@ on:
env:
IMAGE_NAME: ${{ vars.DOCKERHUB_USERNAME }}/voicevox_engine
VOICEVOX_RESOURCE_VERSION: "0.23.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ただのメモコメントです)

あ、VOICEVOX_RESOURCE_VERSIONは本当はなくせそうな気がしますね!!
packageのなかにあるはずなので・・・・・・と思ったら入ってなさそう!!!
じゃあ今の形が良さそう!!

@qryxip
Copy link
Member Author

qryxip commented May 3, 2025

6df0fc5 (#1669): build-latest-devbuild-engien-containerを起動するようになったままだったので、削りました。

@qryxip qryxip requested a review from Hiroshiba May 3, 2025 15:01
Comment on lines -3 to -5
push:
branches:
- master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この変更で、latestがpushされなくなることに気づきました!
今までどおりmainブランチのものをlatestにpushするのは、まあ結構な変更をしないといけない気がします。
(例えばこのymlにlatestとしてpushするフラグを作り、mainブランチをビルドする-devreleases時にそのフラグをtrueにする)

さらに調べてると、そもそもdockerのlatestタグは安定版を提供すべきっぽいことに気づきました!!

個人的には、言われてみればlatestで開発最新版が降ってくるのは一般的じゃない気がするので一般的なのに合わせたいのと、あとまあビルドは1本化したいのと、このPRで一気に仕様変更でも別に良いかな~~~とおもうので、今のPRの内容に賛成です。

メンションしまくってしまって申し訳ないのですが、こちらも意見とかあれば。。。 🙇 @tarepan @aoirint

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latestがpushされなくなる

ことについて気付いたことがあったのでこっちにもぶら下げておきます。
#1669 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1674 (comment) にて latest の仕様変更について返信しました。PR の内容に賛成です。

Comment on lines +32 to +43
: # workflow_call/workflow_dispatchでのバージョン名か、latest
version_or_latest=${{ inputs.version || 'latest' }}

case "$version_or_latest" in
latest) version=$(gh release view -R "$GITHUB_REPOSITORY" --json tagName -q .tagName) ;;
*) version=$version_or_latest
esac

echo "version_or_latest=$version_or_latest" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここ、現状のコードだとversion_or_latestがlatestになることはありえなそうでした!
latestになるのはinputs.versionが空、つまりon: pushのときだけだけど、on: pushが消えてるので。

このコードを残すべきかどうかが難しいんですよね。。。。。。。。
このPR時点ではデッドコードになるけど、latestタグを復活させる場合は有用かもだし。。。。。。

latestを復活させるときに有用かもだから、latestの扱いを考えるissue内に<details>とかでサンプルとしてコードスニペットを置いといて、このPRからは消してしまうとか・・・・・?
ちょっと考えきれてないのですが、一旦コメントまで 🙇

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このコード、消した方が良いかもです・・・!

現状使われてないはず(そもそもこの認識があってるのかどうか。。)。

あと、将来的にも使われないかもだと思いました!
version_or_latestではなく、is_latestis_edgeプラグを用意して、それらのフラグがついてたらlatestedgeも付けてpushする、という流れにもなりえそうだな~~~と。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こういう箇所 (if:)もYAGNIっちゃう感じでしょうか?最低限TODOコメントくらいは置いておかないと、is_edgeとかを追加するときに忘れそうな気がしています。

  run-release-test-workflow:
    # version が指定されている場合のみ実行する
    if: needs.config.outputs.version_or_latest != 'latest'
    needs: [config, build-docker, build-docker-multi-platform]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ちょっとよくわかってないんですけど、例示されているとこのifはYAGNIではなく、現状で必須な気がします!
build-engine.ymlon: pushがあるので。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ、私が指したのはbuild-engine-containerにあるrun-release-test-workflowですね。よく考えたらbuild-engine(旧build-engine-package)にも同名のものがあったのを失念していました。

Copy link
Member

@Hiroshiba Hiroshiba May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あっほんとだ、失礼しました 🙇

新しいlatestもedgeもビルドしたimageのテストが必要なので、このifは要らない・・・はず・・・?

Copy link
Member Author

@qryxip qryxip May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新しいlatestもedgeもビルドしたimageのテストが必要なので、

今のmasterブランチだとそうなっていない(latestに対してスキップされる)ので、是正するなら今のmasterブランチに向けて別PRということになるかなと。

Copy link
Member

@Hiroshiba Hiroshiba May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今のmasterブランチ:latestがビルドされるが、latestに対してのテストはしない
このPRでifをなくしたら:latestがビルドされず、latestに対してのテストはしない

なので、if有無の差分は影響がないのかなと思ってます!

それはさておき、latestのビルドやめるのは破壊的変更だから別PRのが良いのではという感じであれば、賛成です・・・!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このPRでifをなくしたら:latestがビルドされず、

これについては一つ考慮しなくてはならないことがあると思っていて、build-engine-containeron.workflow_dispatchは消していないので、"latest"もしくは""を入力可能だと思います。もっともbuild-latest-devからbuild-engine-containerを呼ぶ箇所は消滅するので、このon.workflow_dispatchは消してもそんなに問題無いかも?

Copy link
Member Author

@qryxip qryxip May 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

それはさておき、latestのビルドやめるのは破壊的変更だから別PRのが良いのではという感じであれば、賛成です・・・!

是正というのは「新しいlatestもedgeもビルドしたimageのテストが必要なので、」に対して、今はlatestに対してビルドを回していないので回すとしたら、という意図でした。


ちょっとこの話はややこしくなりすぎた感じがします。提案なのですが#1669 (comment)のsuggestionを実行し、「とりあえず今はlatestとはmasterブランチの最新版を指す」ということにしませんか…? #1674 のことはこのPRをマージしたで考える感じで。

Refs: VOICEVOX#1669 (comment)
Suggested-by: Hiroshiba <[email protected]>
@qryxip qryxip requested a review from Hiroshiba May 7, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

パッケージ用にビルドしたものをdockerコンテナ内で動かすビルドフローにしたい
4 participants