Skip to content

devcontainer: htop を dev stage に追加 + apt list を両 stage とも ABC sort - #51

Merged
thawk105 merged 1 commit into
masterfrom
devcontainer-add-htop
May 13, 2026
Merged

devcontainer: htop を dev stage に追加 + apt list を両 stage とも ABC sort#51
thawk105 merged 1 commit into
masterfrom
devcontainer-add-htop

Conversation

@thawk105

@thawk105 thawk105 commented May 13, 2026

Copy link
Copy Markdown
Owner

並列 worktree subagent でビルドを回しているときの CPU 使用率を眺める用に htop を入れたい。ついでに base / dev 両 stage の apt-get install リストを ABC 順に並べ替えて、htop も正しい位置 (curl と openssh-client の間) に挿入。

変更

dev stage

     && apt-get install -y --no-install-recommends \
-        zsh \
         clang-format \
-        sudo \
-        openssh-client \
         curl \
+        htop \
+        openssh-client \
+        sudo \
+        zsh \

base stage (CI の :ci でも使われる)

     && apt-get install -y --no-install-recommends \
-        build-essential \
         autoconf \
         automake \
-        libtool \
-        pkg-config \
-        git \
+        build-essential \
         ca-certificates \
         ccache \
         cmake \
+        git \
         libboost-filesystem-dev \
         libgflags-dev \
-        libgoogle-glog-dev
+        libgoogle-glog-dev \
+        libtool \
+        pkg-config

なぜ ABC sort

Docker 公式のベストプラクティス で multi-line args は sort せよと推奨されている:

  • 重複追加を防ぐ (今回 htop を入れるときに既にあるか alphabetical なら一目で確認可能)
  • merge conflict が減る (近接位置に追加されにくくなる)
  • レビュー時に「これ入ってる?」が探しやすい

トレードオフ

  • htop の image size 増分はごく僅か (バイナリ + 依存で数 MB 程度)、dev image にしか入らないので CI 速度には影響なし。
  • 並べ替えだけで挙動は変わらない (依存解決順序も apt 側で決まるので install 結果は同一)。

マージ後の手順

.devcontainer/** を触っているので merge で devcontainer-image.yml が起動し、:latest (dev) と :ci (base) の両方が rebuild される。

  • devcontainer 側: Rebuild Container すると htop が使えるようになる
  • CI 側: 動作変わらず (apt 内容自体は同じ、順番だけ変えた)

Test plan

  • devcontainer-image.yml が走って :latest / :ci が publish される
  • Rebuild Container 後に htop が走る
  • 次の .devcontainer/** 外の PR で CI が緑のまま (= base stage の image が壊れていない確認)

Add `htop` to the dev image so CPU usage is easy to watch while parallel
worktree subagents are running builds. Dev-only — not added to the :ci
slim image since the GHA build job has no use for it.

While here, alphabetize the apt-get install lists in both stages (Docker
docs recommend this for multi-line args: deduplicates, eases review,
cuts merge conflicts). htop slots into c..o naturally between curl and
openssh-client.
@thawk105
thawk105 force-pushed the devcontainer-add-htop branch from 2380256 to 821959f Compare May 13, 2026 13:48
@thawk105 thawk105 changed the title devcontainer: htop を dev stage に追加 devcontainer: htop を dev stage に追加 + apt list を両 stage とも ABC sort May 13, 2026
@thawk105
thawk105 merged commit d2ffad1 into master May 13, 2026
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