8000 ci(sandbox): reuse the published image when its Dockerfile is unchanged by geminixiang · Pull Request #174 · geminixiang/mikan · GitHub
[go: up one dir, main page]

Skip to content

ci(sandbox): reuse the published image when its Dockerfile is unchanged - #174

Merged
geminixiang merged 2 commits into
mainfrom
ci/sandbox-image-reuse
Oct 11, 2026
Merged

geminixiang merged 2 commits into
mainfrom
ci/sandbox-image-reuse

Conversation

@geminixiang
Copy link
Copy Markdown
Owner

為什麼要改

每次發版都會從頭重建 sandbox image,apt-get 每次都產生新的層。結果即使 Dockerfile 完全沒改,每個新版本都有約 936 MB 的新內容。實測 1.0.2 到 1.3.0 每一版都是這樣。

接下來 mikan 會改成使用和版號對應的 image(PR 2),如果不先處理這個問題,使用者每次升級 mikan 都要重新下載約 1 GB,所有 container 也都要重建。

改了什麼

項目 之前 之後
發版時 Dockerfile 沒改,且上一版建置未滿 30 天 從頭重建 直接在上一版 image 上加新版號的 tag(imagetools create),下載量為 0,container 也不會因此重建
Dockerfile 有改,或上一版建置已超過 30 天 重建 重建,並在 image 上加 label 記錄 Dockerfile 的 hash
發佈的 tag sha-*、latest、<version>、tools,預覽版另加 beta 只發佈 <version>;正式版另外更新 latest
smoke 測試 每次都跑 沿用舊 image 時跳過,因為被沿用的 image 建置當時已經測過

「建置超過 30 天就重建」讓 gh、gcloud 等工具大約每月更新一次,不需要另外排定每月的自動建置。

判斷要不要沿用的步驟在 PR 上也會執行,只輸出判斷結果,不會推送。

已知限制

  • 判斷基準是 latest,也就是最新的正式版。Dockerfile 改了之後、下一個正式版發佈之前,每個預覽版都會重建一次。
  • 被沿用的 image 上,org.opencontainers.image.version label 會是原本建置時的版號。

已完成的 package 整理(不在這個 PR 裡)

  • 刪除 5 個沒在用的 package:mama-sandbox、mikan、mikan-agent-sandbox-router、mikan-agent-sandbox-runtime、charts/mikan。
  • mikan-sandbox 從 1,244 個版本整理到 40 個:只保留 1.x 正式版(1.0.0 到 1.3.0)和它們底下的各架構 image。已確認保留的每個版本都能正常 pull。

驗證

  • 這個 PR 的 CI 會執行「判斷是否沿用」步驟,可以在 log 裡看到判斷結果。目前的 latest 沒有 Dockerfile hash label,所以預期結果是「重建」。
  • 第一次真正沿用 image,會發生在這個 PR 合併後發佈的第二個版本。

這個 PR 只改 CI 和文件,不影響 Slack 訊息經過 daemon 的路徑,所以不需要跑 Slack E2E。

Every release rebuilt the sandbox image from scratch, and apt produced
new layers each time, so each mikan release meant a ~940 MB download
even with an unchanged Dockerfile. A release now tags the published
image with its version when the Dockerfile hash matches and the image
is under 30 days old, so tools still refresh about monthly.

Releases publish only :<version>, plus :latest for stable releases; the
sha-, tools, beta, and edge tags had no readers.
@cloudflare-workers-and-pages
cloudflare-workers-and-pages Bot commented Oct 11, 2026 •
Copy link
Copy Markdown

Deploying mikan with  Cloudflare Pages  Cloudflare Pages

Latest commit: 431a205
Status: ✅  Deploy successful!
Preview URL: https://d9c358b6.mikan-1wv.pages.dev
Branch Preview URL: https://ci-sandbox-image-reuse.mikan-1wv.pages.dev

View logs

The created time renders with spaces, and an image published before the
inputs label renders it empty; a pipe-separated line with Unix seconds
keeps every field in place.
@geminixiang
geminixiang force-pushed the ci/sandbox-image-reuse branch from 4a44f30 to 1750042 Compare October 11, 2026 08:08
@geminixiang
geminixiang merged commit b65c492 into main Oct 11, 2026
6 checks passed
@geminixiang
geminixiang deleted the ci/sandbox 7233 -image-reuse branch October 11, 2026 08:16
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.

1 participant

0