update devcontainer

- handle worktrees
- update URLs
This commit is contained in:
Mikaël Francoeur
2026-06-04 19:00:16 +04:00
parent db53f25e40
commit 0f5897dde1
5 changed files with 33 additions and 1 deletions

1
.devcontainer/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.env

View File

@@ -5,6 +5,7 @@
"remoteUser": "node",
"workspaceFolder": "/workspace",
"waitFor": "postStartCommand",
"initializeCommand": ".devcontainer/init-env.sh",
"customizations": {
"vscode": {
"extensions": [

View File

@@ -29,6 +29,8 @@ services:
GO_VERSION: "1.24.10"
RUST_VERSION: "1.88.0"
PYTHON_VERSION: "3.11"
NVM_VERSION: "0.40.1"
NODE_VERSION: "22.13.0"
environment:
NODE_OPTIONS: "--max-old-space-size=4096"
CLAUDE_CONFIG_DIR: "/home/node/.claude"
@@ -40,8 +42,9 @@ services:
networks: [sandbox]
volumes:
- ..:/workspace:delegated
# bind the main worktree, in case this is a linked worktree
- ${MAIN_GIT_DIR:?run .devcontainer/init-env.sh to generate .devcontainer/.env}:${MAIN_GIT_DIR}:delegated
- claude-code-bashhistory:/commandhistory
- claude-code-config:/home/node/.claude
cap_add:
- NET_ADMIN

23
.devcontainer/init-env.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env sh
# Generates .devcontainer/.env so docker-compose can resolve MAIN_GIT_DIR.
#
# /workspace/.git inside the container is bind-mounted from the host. When the
# host workspace is a git worktree, .git is a pointer file containing
# gitdir: <abs-host-path>/.git/worktrees/<name>
# That absolute host path must exist verbatim inside the container, so we
# bind-mount the main repo's .git dir 1:1.
set -eu
cd "$(dirname "$0")/.."
if [ -f .git ]; then
gitdir=$(sed -n 's|^gitdir: ||p' .git)
main_git_dir=${gitdir%/worktrees/*}
elif [ -d .git ]; then
main_git_dir="$(pwd)/.git"
else
echo "init-env.sh: no .git found in $(pwd)" >&2
exit 1
fi
printf 'MAIN_GIT_DIR=%s\n' "$main_git_dir" > .devcontainer/.env

View File

@@ -10,11 +10,15 @@ acl allowed dstdomain \
.crates.io \
.static.rust-lang.org \
.npmjs.org \
.nodejs.org \
.github.com \
.githubusercontent.com \
.go.dev \
.golang.org \
.anthropic.com \
.claude.ai \
.claude.com \
.platform.claude.com \
.openai.com \
.sentry.io \
.statsig.com \