-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add image version tracking to DevContainer #472
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # check-image-version.sh - DevContainer イメージのバージョン情報を表示 | ||
| # | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| VERSION_FILE="/etc/config-base-version" | ||
|
|
||
| # バージョンファイルの確認 | ||
| if [ -f "$VERSION_FILE" ]; then | ||
| VERSION=$(cat "$VERSION_FILE") | ||
| echo "config-base version: $VERSION" | ||
| else | ||
| echo "config-base version: unknown (version file not found)" | ||
| echo "" | ||
| echo "Note: Version tracking was added in v1.64.0" | ||
| echo "Consider updating to the latest image: ghcr.io/keito4/config-base:latest" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # オプション: 詳細表示 | ||
| if [ "${1:-}" = "-v" ] || [ "${1:-}" = "--verbose" ]; then | ||
| echo "" | ||
| echo "Additional info:" | ||
| echo " Image source: https://github.com/keito4/config" | ||
| echo " Releases: https://github.com/keito4/config/releases" | ||
|
|
||
| # Docker ラベルから追加情報を取得(コンテナ外で実行時) | ||
| if command -v docker &> /dev/null; then | ||
| CURRENT_IMAGE=$(docker inspect --format '{{.Config.Image}}' "$(hostname)" 2>/dev/null || echo "") | ||
| if [ -n "$CURRENT_IMAGE" ]; then | ||
| echo " Current image: $CURRENT_IMAGE" | ||
| fi | ||
| fi | ||
| fi |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving
LABELto the end of the Dockerfile would preserve layer caching.The
LABELon line 9 references${IMAGE_VERSION}, so every time the version changes, Docker invalidates this layer and all subsequent layers — forcing a full rebuild of the heavyapt-get, Node.js, Rust, npm install steps, etc. This negates registry cache benefits.Move the
LABELblock down next to the version-file write (around line 164) so that only the final layers are invalidated when the version changes.Proposed fix
Then near the end of the Dockerfile (after line 162):
# Write version file for easy version checking RUN echo "${IMAGE_VERSION}" > /etc/config-base-version \ && chmod 644 /etc/config-base-version + +# OCI Image Labels for version tracking (placed late to preserve layer cache) +LABEL org.opencontainers.image.version="${IMAGE_VERSION}" \ + org.opencontainers.image.source="https://github.com/keito4/config" \ + org.opencontainers.image.title="config-base" \ + org.opencontainers.image.description="DevContainer base image with Claude Code, Codex, and development tools"🤖 Prompt for AI Agents