build-and-push-ecr: イメージをamd64/arm64のマルチアーキでビルドする (imastodon-v4.7) - #577
Merged
Merged
Conversation
Fargateのarm64は同一vCPU数でx86比約20%安い。webappの0.5vCPU化を1週間観察した 結果、CPUを削る方向はレイテンシとのトレードオフが大きいと分かったため、 コスト削減は単価を下げる方向で取る。 arm64単独ではなく両対応にするのは、切り戻しの粒度を分けるため。arm64単独だと タスク定義のcpuArchitectureをX86_64に戻したときに現行タグのイメージが引けず、 ARM64化以前の古いタグまでアプリを巻き戻す必要が出る。migrateも同じイメージを 使うため、スキーマが先に進んだ状態でアプリだけ巻き戻すのは危険。両対応なら 同じイメージタグのままアーキテクチャだけ切り戻せる。 アーキテクチャごとにジョブを分け、それぞれのネイティブランナーでビルドして push-by-digestでpushし、build_manifestジョブがjob outputsで受け取った ダイジェストからimagetools createでマニフェストを統合する。arm64標準ランナーが 2026年1月末から利用可能になったため、QEMUエミュレーションは使わない。2ジョブは 並列に走るので実時間はほぼ増えない。 registryキャッシュのrefはアーキテクチャごとに分ける。分けないと2つのビルド ジョブが同一のcache_tagに書き込んで互いのキャッシュを潰し合う。 タスク定義側のruntimePlatform指定はimastodonブランチで別途行う。 ARM64化は2026-03-15にPR #511(imastodon)/#510(v4.3)で一度入れたが、 当時使っていたbitnami/pgbouncerにarm64ビルドが無く同日中にPR #513/#512で revertした。現在はedoburu/pgbouncer:v1.25.1-p0に差し替わっておりlinux/arm64を 持つ。aws-for-fluent-bit:stableも同様。当時の阻害要因は解消している。 なお検証タグimastodon-20260822-arm64-testでのarm64単独ビルドは6分45秒で成功し、 libvips関連を含むネイティブ拡張がarm64で問題なくビルドできることは確認済み。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014DX1ChKk8nn8rGGnoyDnzj (cherry picked from commit c192483) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K3PnPvd53jvt8Qy7Qq9gqP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#563 で imastodon-v4.5 に入れたマルチアーキビルドを
imastodon-v4.7にも cherry-pick する。v4.6 を本番に切り替える前に、各ブランチでビルドされるイメージを amd64/arm64 の両対応にしておく必要がある。
判断背景はコミットメッセージと #563 を参照。
🤖 Generated with Claude Code