Skip to content

chore: Dockerfile のビルド再現性・保守性を改善 - #509

Merged
keito4 merged 1 commit into
mainfrom
chore/dockerfile-improvements
Feb 23, 2026
Merged

chore: Dockerfile のビルド再現性・保守性を改善#509
keito4 merged 1 commit into
mainfrom
chore/dockerfile-improvements

Conversation

@keito4

@keito4 keito4 commented Feb 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • ベースイメージを mcr.microsoft.com/devcontainers/base:ubuntu から mcr.microsoft.com/devcontainers/base:1-ubuntu-24.04 にタグ固定し、ビルドの再現性を向上
  • Doppler CLI (3.75.2) と 1Password CLI (2.32.1) のバージョンを ARG に外出しし、docker build --build-arg でバージョン変更を容易に
  • devcontainer.json から ghcr.io/devcontainers/features/node:1 を削除(Dockerfile で Node.js v22.14.0 を直接インストール済みのため重複)

Test plan

  • docker build.devcontainer/Dockerfile で正常に完了すること
  • --build-arg DOPPLER_CLI_VERSION=x.y.z でバージョン指定ビルドが動作すること
  • --build-arg OP_CLI_VERSION=x.y.z でバージョン指定ビルドが動作すること
  • DevContainer 起動後に node --version が v22.14.0 を返すこと
  • DevContainer 起動後に doppler --version が正しいバージョンを返すこと
  • DevContainer 起動後に op --version が正しいバージョンを返すこと

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated development container base image to a newer version.
    • Made CLI dependency versions configurable with default values.
    • Simplified development container feature configuration.

- ベースイメージを 1-ubuntu-24.04 にタグ固定
- Doppler/1Password CLI バージョンを ARG に外出し
- Node.js feature を削除(Dockerfile で既にインストール済み)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 23, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Updated the development container configuration by parameterizing CLI tool versions in the Dockerfile through build arguments, updating the base image reference, and removing the Node.js feature from devcontainer.json.

Changes

Cohort / File(s) Summary
DevContainer Configuration
.devcontainer/Dockerfile
Added build arguments DOPPLER_CLI_VERSION and OP_CLI_VERSION for parameterized CLI versions; updated base image from base:ubuntu to base:1-ubuntu-24.04; replaced hard-coded version strings with argument references.
DevContainer Features
.devcontainer/devcontainer.json
Removed Node.js feature entry that was used solely for pnpm installation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested labels

size/S

Poem

A rabbit hops through version seas,
Where Doppler flows and 1Pass trees,
With arguments so clean and bright,
The config grows more flexible, right! 🐰✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main changes: improving Dockerfile build reproducibility and maintainability, which aligns with pinning base image, externalizing CLI versions as ARGs, and removing duplicate Node.js feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/dockerfile-improvements

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude

claude Bot commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

コードレビュー

概要

変更の意図(ビルド再現性向上・バージョン管理の改善)は明確で方向性は正しいです。ただし、pnpm の削除に関して影響範囲の確認が必要です。


懸念点

🔴 重要: pnpm が利用不可になる可能性

devcontainer.json から ghcr.io/devcontainers/features/node:1 を削除しましたが、このフィーチャーは pnpmVersion: "latest" を通じて pnpm のインストール も担っていました。

元のコメントには「This feature is kept solely for pnpm installation.」と明記されており、削除後は pnpm が環境に存在しない状態になります。

CLAUDE.md では以下のように記載されています:

パッケージマネージャー(npm / pnpm / yarn / bun)はロックファイルから自動判定されます。

pnpm を使用するリポジトリで DevContainer を起動した場合、Quality Gates が失敗するリスクがあります。

対応案:

# Dockerfile に pnpm インストールを追加
RUN npm install -g pnpm

または devcontainer.json に独立した pnpm インストール手段を追加。


良い点

✅ ベースイメージのタグ固定

ubuntu1-ubuntu-24.04 への変更はビルド再現性の向上に効果的です。

✅ ARG による外部化

DOPPLER_CLI_VERSIONOP_CLI_VERSION の ARG 外出しにより、--build-arg でのバージョン上書きが可能になり、保守性が向上しています。ARG の配置も各 RUN 直前という正しい位置になっており、キャッシュ効率も良好です。


軽微な指摘

ℹ️ チェックサム検証なし(既存の問題)

Doppler CLI・1Password CLI のダウンロードにチェックサム検証がありませんが、これは既存の問題で今回の PR スコープ外です。将来的な改善として検討ください。

ℹ️ 1Password の重複インストール(既存の問題)

devcontainer.jsonghcr.io/itsmechlark/features/1password:1 が残っており、Dockerfile でも直接インストールしているため重複しています。こちらも既存の問題です。


まとめ

pnpm のインストールを別途担保する変更を追加することを推奨します。テストプランの「DevContainer 起動後に node --version が v22.14.0 を返すこと」に加えて、「pnpm --version が動作すること」の確認も追記するとより安全です。

🤖 Reviewed by Claude Code

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.devcontainer/Dockerfile (2)

42-42: Redundant intermediate variable assignment

DOPPLER_VERSION="${DOPPLER_CLI_VERSION}" and OP_VERSION="${OP_CLI_VERSION}" are immediately used only within the same RUN shell session; the ARG is already directly available as an environment variable in that context. The extra alias adds noise without benefit.

♻️ Proposed simplification
-RUN DOPPLER_VERSION="${DOPPLER_CLI_VERSION}" \
- && ARCH=$(dpkg --print-architecture) \
- && curl -sLo /tmp/doppler.deb "https://github.com/DopplerHQ/cli/releases/download/${DOPPLER_VERSION}/doppler_${DOPPLER_VERSION}_linux_${ARCH}.deb" \
+RUN ARCH=$(dpkg --print-architecture) \
+ && curl -sLo /tmp/doppler.deb "https://github.com/DopplerHQ/cli/releases/download/${DOPPLER_CLI_VERSION}/doppler_${DOPPLER_CLI_VERSION}_linux_${ARCH}.deb" \
-RUN OP_VERSION="${OP_CLI_VERSION}" \
- && ARCH=$(dpkg --print-architecture) \
- && curl -sSfo /tmp/op.zip "https://cache.agilebits.com/dist/1P/op2/pkg/v${OP_VERSION}/op_linux_${ARCH}_v${OP_VERSION}.zip" \
+RUN ARCH=$(dpkg --print-architecture) \
+ && curl -sSfo /tmp/op.zip "https://cache.agilebits.com/dist/1P/op2/pkg/v${OP_CLI_VERSION}/op_linux_${ARCH}_v${OP_CLI_VERSION}.zip" \

Also applies to: 52-52

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.devcontainer/Dockerfile at line 42, The RUN step sets redundant shell
aliases DOPPLER_VERSION="${DOPPLER_CLI_VERSION}" and
OP_VERSION="${OP_CLI_VERSION}" which are unnecessary because the build ARGs are
already available in the RUN shell; remove those intermediate assignments and
use the ARG-provided variables (DOPPLER_CLI_VERSION, OP_CLI_VERSION) directly in
the RUN commands (refer to the RUN line containing DOPPLER_VERSION and the
similar OP_VERSION assignment) to simplify the Dockerfile.

42-46: No binary integrity verification for downloaded artifacts

Both the Doppler .deb and the 1Password .zip are downloaded and installed without any checksum or signature check. The Doppler CLI documentation mentions "instructions on verifying binary signatures", and each GitHub release ships a checksums.txt + checksums.txt.sig. 1Password's own install docs say to "Download the latest release… Learn how to verify its authenticity." With version numbers now coming in via --build-arg, a typo or supply-chain compromise would silently install an unverified binary.

Consider adding SHA256 verification after each download:

🛡️ Proposed fix — Doppler integrity check
 RUN DOPPLER_VERSION="${DOPPLER_CLI_VERSION}" \
  && ARCH=$(dpkg --print-architecture) \
  && curl -sLo /tmp/doppler.deb "https://github.com/DopplerHQ/cli/releases/download/${DOPPLER_VERSION}/doppler_${DOPPLER_VERSION}_linux_${ARCH}.deb" \
+ && curl -sLo /tmp/doppler_checksums.txt "https://github.com/DopplerHQ/cli/releases/download/${DOPPLER_VERSION}/checksums.txt" \
+ && grep "doppler_${DOPPLER_VERSION}_linux_${ARCH}.deb" /tmp/doppler_checksums.txt | sha256sum -c - \
  && dpkg -i /tmp/doppler.deb \
- && rm /tmp/doppler.deb
+ && rm /tmp/doppler.deb /tmp/doppler_checksums.txt

Also applies to: 52-59

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.devcontainer/Dockerfile around lines 42 - 46, The Doppler .deb download
block (uses DOPPLER_CLI_VERSION / DOPPLER_VERSION, ARCH, /tmp/doppler.deb) must
verify integrity: download the matching checksums.txt and checksums.txt.sig from
the same release, import/verify the Doppler maintainer GPG key with gpg --verify
against checksums.txt.sig, then compute the SHA256 of /tmp/doppler.deb
(sha256sum) and compare it to the expected value in checksums.txt before running
dpkg -i; if verification fails, exit non‑zero and do not install. Apply the same
pattern to the 1Password download steps (the 1Password .zip section referenced
at lines 52-59): fetch checksums and signature, verify signature, then compare
computed SHA256 of the downloaded .zip to the checksums file and abort on
mismatch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.devcontainer/Dockerfile:
- Line 42: The RUN step sets redundant shell aliases
DOPPLER_VERSION="${DOPPLER_CLI_VERSION}" and OP_VERSION="${OP_CLI_VERSION}"
which are unnecessary because the build ARGs are already available in the RUN
shell; remove those intermediate assignments and use the ARG-provided variables
(DOPPLER_CLI_VERSION, OP_CLI_VERSION) directly in the RUN commands (refer to the
RUN line containing DOPPLER_VERSION and the similar OP_VERSION assignment) to
simplify the Dockerfile.
- Around line 42-46: The Doppler .deb download block (uses DOPPLER_CLI_VERSION /
DOPPLER_VERSION, ARCH, /tmp/doppler.deb) must verify integrity: download the
matching checksums.txt and checksums.txt.sig from the same release,
import/verify the Doppler maintainer GPG key with gpg --verify against
checksums.txt.sig, then compute the SHA256 of /tmp/doppler.deb (sha256sum) and
compare it to the expected value in checksums.txt before running dpkg -i; if
verification fails, exit non‑zero and do not install. Apply the same pattern to
the 1Password download steps (the 1Password .zip section referenced at lines
52-59): fetch checksums and signature, verify signature, then compare computed
SHA256 of the downloaded .zip to the checksums file and abort on mismatch.

@keito4
keito4 merged commit 6f1c555 into main Feb 23, 2026
16 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.81.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Feb 23, 2026
@claude claude Bot mentioned this pull request Mar 1, 2026
github-actions Bot added a commit that referenced this pull request Mar 1, 2026
- .devcontainer/README.md / VERSIONING.md: config-base イメージバージョンを v1.54.0 → v1.81.1 に更新
- docs/tool-catalog.md:
  - npm 11.10.0 → 11.10.1, @openai/codex 0.101.0 → 0.104.0, @google/gemini-cli 0.28.2 → 0.29.5
  - Vercel CLI 50.17.1 → 50.22.1, n8n 2.7.5 → 2.8.3, yaml-language-server 1.19.2 → 1.20.0
  - @commitlint/{cli,config-conventional} 20.4.1 → 20.4.2
  - Features テーブルから node Feature を削除(PR #509 で devcontainer.json より削除済み)
  - セクション 6.1 の最新バージョン記載を 1.58.0+ → 1.81.1 に更新
- script/README.md: .shellcheck-exclude ファイルの説明を追加(PR #507Closes #513

Co-authored-by: keito4 <keito4@users.noreply.github.com>
@keito4
keito4 deleted the chore/dockerfile-improvements branch March 1, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant