ci: Docker image ビルドキャッシュを整備#227
Open
h-takeyeah wants to merge 7 commits intodevelopfrom
Open
Conversation
使われていないので
他にもリポジトリのURLなどがイメージに書き込まれる 詳しくは https://github.com/docker/metadata-action
Cache に type=gha (GitHub Actions Cache) を使うには builder の driver として docker-container を選択する必要がある ローカルで実験するときその点に注意
Collaborator
Author
|
検討したいこと追加で,
|
There was a problem hiding this comment.
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Files not reviewed (1)
- docker/docker-bake.hcl: Language not supported
Comments suppressed due to low confidence (4)
typing-server/docker-compose.yml:8
- Removal of the API volume mount may lead to issues if syncing local API code with the container was expected. Verify that this removal is intentional.
- volumes:
typing-server/docker-compose.dev.yml:8
- Removal of the API volume mount in the development configuration may affect local development workflows. Confirm that this change is deliberate.
- volumes:
.github/workflows/build-image.yml:46
- Ensure the tag pattern 'pattern={{raw}}' in the Docker metadata action is valid and produces the expected tag format.
type=semver,pattern={{raw}}
.github/workflows/build-image.yml:56
- Verify that using the 'cwd://' prefix with the output from the Docker metadata action is supported in docker/bake-action v6 configuration.
cwd://${{ steps.meta.outputs.bake-file-annotations }}
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.
チケットへのリンク
やったこと
(1) Docker image につけるメタデータの管理を docker/metadata-action に委譲したことでビルドされる Docker image にタグ以外に色々情報を付けられるようになった
画像は個人のリポジトリで実験したときにビルドしたイメージを
docker image inspectコマンドで調べたときの様子ですが,ご覧のようにバージョンの情報などがLABELの形でついているのが分かると思います(2) ビルドキャッシュを保存するようにしたことで run 間1でキャッシュを共有できるようになり,ビルド時間の短縮が見込める
実験した結果です.イメージのレイヤーをキャッシュするので Go も JavaScript も関係なく速くなりますね.
2点注意があるので参考程度に見てください
apk addのレイヤーとかは不変なはずなので,そこはいつも速くなると思うやらないこと
できるようになること(ユーザ目線)
開発者目線で言えば手元に Docker image を
docker pull ghcr.io/su-its/typing-server:latestとして持ってきたときに,その image がどの時点のソースコードをもとにビルドされたのかを特定できるようになって嬉しい.docker pull ghcr.io/su-its/typing-server:latest docker image inspect --format '{{.Config.Labels}}' ghcr.io/su-its/typing-server:latestできなくなること(ユーザ目線)
動作確認
その他
source: .を明示して今まで通りのやり方になるようにしていますFootnotes
GitHub の用語では1度のワークフロー実行を run という ↩