- 変更履歴
Dockerfile内でARGタグを使用してイメージのバージョンを指定するように変更しました。
pnpmを追加しました。
日本語設定を追加しました。
gitの安全なディレクトリに作業フォルダーを追加しました。
NodeSourceリポジトリからNode.js公式バイナリ直接ダウンロードに変更しました。
DevContainerビルド時に以下のエラーが発生しました。
E: The repository 'https://deb.nodesource.com/node_20.x nodistro InRelease' is not signed.
ERROR: Feature "GitHub CLI" (ghcr.io/devcontainers/features/github-cli) failed to install!
NodeSourceリポジトリのGPG署名がSHA1を使用しており、Debian Trixieでは2026年2月1日以降SHA1署名がセキュリティポリシーで拒否されるようになりました。
Sub-process /usr/bin/sqv returned an error code (1), error message is:
Signing key on 6F71F525282841EEDAF851B42F59B5F99B1BE0B4 is not bound:
No binding signature at time 2026-01-19T15:27:46Z
because: Policy rejected non-revocation signature (PositiveCertification)
requiring second pre-image resistance
because: SHA1 is not considered secure since 2026-02-01T00:00:00Z
Node.js公式サイトからバイナリを直接ダウンロードしてインストールする方式に変更しました。
変更前(NodeSourceリポジトリ使用):
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*変更後(公式バイナリ直接ダウンロード):
ARG NODE_VERSION=20.18.2
RUN ARCH=$(dpkg --print-architecture) \
&& case "${ARCH}" in \
amd64) NODE_ARCH="x64" ;; \
arm64) NODE_ARCH="arm64" ;; \
*) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \
esac \
&& curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" \
-o /tmp/node.tar.xz \
&& tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \
&& rm /tmp/node.tar.xz \
&& ln -sf /usr/local/bin/node /usr/local/bin/nodejs \
&& node --version \
&& npm --version- Dockerfile: Node.jsインストール方法を変更
- local-build/Dockerfile.base: 同上
- その他のファイル: 変更なし
xz-utils:.tar.xzファイルの展開に必要
Debian 13 (trixie) が2026年2月1日からSHA1署名を拒否するセキュリティポリシーを適用。
NodeSourceリポジトリのGPGキーがSHA1で署名されているため、apt-get update 時に検証エラーが発生。
E: The repository 'https://deb.nodesource.com/node_20.x nodistro InRelease' is not signed.
W: OpenPGP signature verification failed: ... SHA1 is not considered secure since 2026-02-01T00:00:00Z
NodeSourceリポジトリの使用を廃止し、Node.js公式バイナリを直接ダウンロード・インストールする方式に変更。
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*ENV NODE_VERSION=20.18.2
RUN ARCH=$(dpkg --print-architecture) \
&& case "${ARCH}" in \
amd64) NODE_ARCH='x64' ;; \
arm64) NODE_ARCH='arm64' ;; \
armhf) NODE_ARCH='armv7l' ;; \
*) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \
esac \
&& curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" -o /tmp/node.tar.xz \
&& tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \
&& rm /tmp/node.tar.xz \
&& node --version \
&& npm --versionNode.jsのtar.xzアーカイブを展開するため、xz-utils パッケージを追加。
- 外部リポジトリに依存しない
- マルチアーキテクチャ対応(amd64, arm64, armhf)
- バージョン管理が明示的(
NODE_VERSION環境変数)
- Dockerfile: Node.jsインストール方法を変更
- local-build/Dockerfile.base: 同上
- その他のファイル: 変更なし
- 2024年に誤っていたのを2025年に修正
- 影響を受けるファイルをリンクに修正
- masterとすべきところをmainとしていたのを修正
- CHANGELOG.md: ドキュメント修正
- .github/workflows/build-image.yml: Release Noteリンク先修正
- その他のファイル: 変更なし
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
- GitHub CLI (
gh release create) に変更 - リリースノートをファイル経由で生成
- build-image.yml: リリース作成方法を修正
- その他のファイル: 変更なし
- OpenSSH-Clientが不足しているため、git pullが実行できない問題に対応
vscode@75afcbc74201:/workspaces/vehicle-management$ git pull
error: cannot run ssh: No such file or directory
fatal: unable to fork openssh-client \ # 追加- Dockerfile: OpenSSH-Clientを追加
- local-build/Dockerfile.base: 同上
- その他のファイル: 変更なし
- ワークフローの起動条件を手動限定に変更しました。
- .github/workflows/build-image.yml: 起動条件を手動限定に変更
- その他のファイル: 変更なし
ERROR: failed to build: invalid tag "ghcr.io/223n/devcontainer-base:-19c746a":
invalid reference format
docker/metadata-action@v5の設定で、以下のタグ生成ルールが問題でした:
tags: |
type=sha,prefix={{branch}}-{{branch}}が空になるケースがあり、-19c746aのように - で始まる不正なタグが生成されていました。
変更前:
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix={{branch}}- # ← 問題箇所
type=ref,event=branch変更後:
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix=sha- # ← 固定プレフィックスに変更正常なDockerタグが生成されるようになりました:
# 変更前(エラー)
ghcr.io/223n/devcontainer-base:-19c746a # 不正
# 変更後(正常)
ghcr.io/223n/devcontainer-base:sha-19c746a # 正常- .github/workflows/build-image.yml: タグ生成ルールを修正
- その他のファイル: 変更なし
バージョンv1.0.2をプッシュした場合の生成タグ例:
ghcr.io/223n/devcontainer-base:latest # 最新版
ghcr.io/223n/devcontainer-base:1.0.2 # 完全バージョン
ghcr.io/223n/devcontainer-base:1.0 # マイナーバージョン
ghcr.io/223n/devcontainer-base:1 # メジャーバージョン
ghcr.io/223n/devcontainer-base:sha-19c746a # コミットSHAgit config --global core.editor "nano"- グローバルnpmパッケージのインストールをvscodeユーザー作成前に移動
- rootユーザーでインストールすることで権限エラーを解消
# vscodeユーザーの作成
RUN groupadd --gid 1000 vscode && ...
# vscodeユーザーに切り替え
USER vscode
# グローバルnpmパッケージのインストール ← ここで権限エラー
RUN npm install -g \
wrangler@latest \
typescript@latest \
prettier@latest# グローバルnpmパッケージのインストール(rootユーザーで実行)
RUN npm install -g \
wrangler@latest \
typescript@latest \
prettier@latest
# vscodeユーザーの作成
RUN groupadd --gid 1000 vscode && ...
# vscodeユーザーに切り替え
USER vscodenpm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
ERROR: failed to solve: process "/bin/sh -c npm install -g ..." did not complete successfully: exit code: 243
- Dockerfile: グローバルnpmパッケージインストールの順序変更
- local-build/Dockerfile.base: 同上
- その他のファイル: 変更なし
# ローカルビルド
cd .devcontainer
./build-base.sh
# または直接ビルド
docker build -f Dockerfile -t 223n-devcontainer-base:latest .ビルドが成功することを確認してください。
- Debian 13 (trixie) ベース
- Node.js 20 LTS
- vscodeユーザー(UID/GID: 1000)
- Git設定の自動適用
- direnv統合