Skip to content

Commit 972bb23

Browse files
chapterjasonclaude
andcommitted
Install gh CLI and Copilot CLI with persisted config
Adds gh via upstream's apt repo (auto-updating, signed by GitHub's key) and the Copilot CLI via gh.io/copilot-install. Both drop home-persist manifests so logins and extension state survive workspace rebuilds: .config/gh/ + .local/share/gh/ for gh, .copilot/ for Copilot CLI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 32d48a8 commit 972bb23

3 files changed

Lines changed: 57 additions & 0 deletions

File tree

scripts/copilot/install.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
# GitHub Copilot CLI installer. Runs as the workspace user — the upstream
3+
# installer drops the binary into $HOME/.local/bin/copilot (on PATH via
4+
# claude-code's .profile hook). Requires an active Copilot subscription at
5+
# runtime; the install itself needs no auth.
6+
# https://gh.io/copilot-install
7+
set -e
8+
9+
curl -fsSL https://gh.io/copilot-install | bash
10+
11+
if [ ! -x "$HOME/.local/bin/copilot" ]; then
12+
echo "copilot: expected $HOME/.local/bin/copilot after install, but it was not found." >&2
13+
exit 1
14+
fi
15+
16+
# Persist Copilot CLI state across workspace rebuilds. ~/.copilot holds
17+
# config.json (auth + settings), session-state/ (chat history, checkpoints),
18+
# and logs/ — persist the whole dir so logins and sessions survive.
19+
sudo mkdir -p /etc/home-persist.d
20+
sudo tee /etc/home-persist.d/copilot.json >/dev/null <<'EOF'
21+
{
22+
"source": "copilot",
23+
"paths": [".copilot/"]
24+
}
25+
EOF

scripts/gh/install.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
# GitHub CLI installer. Runs as root. Adds cli.github.com's apt repo and
3+
# installs gh system-wide — the upstream-recommended path on Debian.
4+
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md
5+
set -e
6+
7+
install -m 0755 -d /etc/apt/keyrings
8+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
9+
-o /etc/apt/keyrings/githubcli-archive-keyring.gpg
10+
chmod a+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
11+
12+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
13+
> /etc/apt/sources.list.d/github-cli.list
14+
15+
apt-get update
16+
apt-get install -y --no-install-recommends --no-install-suggests gh
17+
rm -rf /var/lib/apt/lists/*
18+
19+
# Persist gh config + extensions across workspace rebuilds. ~/.config/gh
20+
# holds config.yml and hosts.yml (auth tokens); ~/.local/share/gh holds
21+
# anything installed via `gh extension install`.
22+
mkdir -p /etc/home-persist.d
23+
cat > /etc/home-persist.d/gh.json <<'EOF'
24+
{
25+
"source": "gh",
26+
"paths": [".config/gh/", ".local/share/gh/"]
27+
}
28+
EOF

src/base/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ RUN --mount=type=bind,source=scripts/home-persist,target=/scripts/home-persist \
8787
bash /scripts/home-persist/install.sh
8888
RUN --mount=type=bind,source=scripts/icu,target=/scripts/icu \
8989
bash /scripts/icu/install.sh
90+
RUN --mount=type=bind,source=scripts/gh,target=/scripts/gh \
91+
bash /scripts/gh/install.sh
9092
RUN --mount=type=bind,source=scripts/jetbrains,target=/scripts/jetbrains \
9193
bash /scripts/jetbrains/install.sh
9294

@@ -97,6 +99,8 @@ RUN --mount=type=bind,source=scripts/nvm,target=/scripts/nvm \
9799
bash /scripts/nvm/install.sh
98100
RUN --mount=type=bind,source=scripts/claude-code,target=/scripts/claude-code \
99101
bash /scripts/claude-code/install.sh
102+
RUN --mount=type=bind,source=scripts/copilot,target=/scripts/copilot \
103+
bash /scripts/copilot/install.sh
100104
RUN --mount=type=bind,source=scripts/rtk,target=/scripts/rtk \
101105
bash /scripts/rtk/install.sh
102106
RUN --mount=type=bind,source=scripts/web-shell,target=/scripts/web-shell \

0 commit comments

Comments
 (0)