Skip to content

Commit 64809dd

Browse files
Paul UrbelCopilot
andcommitted
feat: add devcontainer for cross-platform development
Adds a devcontainer configuration using the Microsoft Node 22 base image with GitHub CLI. Installs pnpm dependencies and Claude CLI during post-create setup. Security: no host credentials are forwarded via containerEnv. Users authenticate interactively after creation (gh auth login, claude login). VS Code forwards GitHub auth automatically for the Copilot extension. Also adds a 'devcontainer' label rule to .github/labeler.yml. Co-authored-by: Copilot <[email protected]>
1 parent 617f97d commit 64809dd

4 files changed

Lines changed: 77 additions & 0 deletions

File tree

‎.devcontainer/Dockerfile‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Development container for OpenClaw.
2+
# Based on the Microsoft Node 22 devcontainer image.
3+
# Pre-installs GitHub CLI and Claude CLI so that devcontainer features
4+
# are not needed (features require `buildx` and break with remote Podman).
5+
6+
FROM mcr.microsoft.com/devcontainers/javascript-node:22-bookworm
7+
8+
# Install GitHub CLI.
9+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
10+
| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \
11+
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \
12+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
13+
> /etc/apt/sources.list.d/github-cli.list && \
14+
apt-get update && \
15+
apt-get install -y --no-install-recommends gh && \
16+
rm -rf /var/lib/apt/lists/*
17+
18+
# Install Claude CLI globally.
19+
RUN npm install -g @anthropic-ai/claude-code
20+
21+
# Enable corepack so pnpm is available.
22+
RUN corepack enable

‎.devcontainer/devcontainer.json‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "OpenClaw",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
7+
// No host secrets are forwarded via containerEnv. Authenticate
8+
// interactively after creation (VS Code forwards GitHub auth
9+
// automatically for Copilot; run `gh auth login` or `claude login`
10+
// for CLI usage).
11+
"postCreateCommand": "bash .devcontainer/on-create.sh",
12+
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"github.copilot",
17+
"github.copilot-chat",
18+
"github.vscode-pull-request-github",
19+
"oxc.oxc-vscode"
20+
],
21+
"settings": {
22+
"terminal.integrated.defaultProfile.linux": "bash"
23+
}
24+
}
25+
},
26+
27+
"remoteUser": "node"
28+
}

‎.devcontainer/on-create.sh‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# Post-create setup for the OpenClaw devcontainer.
3+
# Installs project dependencies and coding-agent CLIs.
4+
#
5+
# Security: no host credentials are forwarded via containerEnv.
6+
# Authenticate interactively after creation:
7+
# gh auth login — for GitHub CLI / Copilot CLI
8+
# claude login — for Claude CLI
9+
# VS Code forwards GitHub auth automatically for the Copilot extension.
10+
set -euo pipefail
11+
12+
echo "==> Installing project dependencies..."
13+
pnpm install
14+
15+
echo ""
16+
echo "==> Setup complete!"
17+
echo ""
18+
echo " Authenticate when ready:"
19+
echo " gh auth login — GitHub CLI + Copilot CLI"
20+
echo " claude login — Claude CLI"
21+
echo ""
22+
echo " GitHub Copilot in VS Code works automatically via the extension."

‎.github/labeler.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@
255255
- "docs/install/docker.md"
256256
- "docs/multi-agent-sandbox-tools.md"
257257

258+
"devcontainer":
259+
- changed-files:
260+
- any-glob-to-any-file:
261+
- ".devcontainer/**"
262+
258263
"agents":
259264
- changed-files:
260265
- any-glob-to-any-file:

0 commit comments

Comments
 (0)