headroom/.devcontainer/devcontainer.json
chopratejas 9ce61afcd4 fix(ci): use ghcr devcontainer rust feature instead of manual rustup install
PR #360's first run after the rustup-component fix exposed a deeper
issue: the devcontainer's manual rustup install in .devcontainer/Dockerfile
runs as root and leaves /usr/local/cargo root-owned. When post-create.sh
later runs `uv sync` as the `vscode` user, maturin → cargo can't write
to the registry cache:

    warning: failed to write cache, path:
      /usr/local/cargo/registry/index/.../aho-corasick,
    error: Permission denied (os error 13)

The official ghcr.io/devcontainers/features/rust:1 feature solves this
by chowning the toolchain dirs to the runtime user (and adding them to
a `rustlang` group). It also handles component installation cleanly so
we don't need the manual `-c rustfmt -c clippy` workaround in the
container build.

Changes:
- .devcontainer/devcontainer.json: add rust feature with version=1.95.0,
  profile=minimal, components=rustfmt,clippy
- .devcontainer/memory-stack/devcontainer.json: same
- .devcontainer/Dockerfile: drop manual rustup install (feature replaces
  it). Keep the apt-get pkg-config + libssl-dev for openssl-sys, and
  the maturin pip install.

Note: e2e/{init,wrap}/Dockerfile keep their manual rustup install
because they're stand-alone runtime images, not devcontainers.
2026-05-03 13:42:43 -07:00

70 lines
2.2 KiB
JSON

{
"name": "Headroom",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "20"
},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/rust:1": {
"version": "1.95.0",
"profile": "minimal",
"components": "rustfmt,clippy"
}
},
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"remoteUser": "vscode",
"updateRemoteUserUID": true,
"init": true,
"containerEnv": {
"PIP_DISABLE_PIP_VERSION_CHECK": "1",
"PYTHONUNBUFFERED": "1",
"UV_LINK_MODE": "copy",
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venvs/headroom"
},
"mounts": [
"source=headroom-venv-${localWorkspaceFolderBasename},target=/home/vscode/.venvs,type=volume",
"source=headroom-uv-cache,target=/home/vscode/.cache/uv,type=volume",
"source=headroom-pip-cache,target=/home/vscode/.cache/pip,type=volume",
"source=${localWorkspaceFolder}/../../../../../../../../,target=/workspaces-host,type=bind,consistency=cached"
],
"postCreateCommand": "bash .devcontainer/post-create.sh",
"postStartCommand": "bash -lc 'git rev-parse --git-dir >/dev/null 2>&1 && git config --global --add safe.directory \"${containerWorkspaceFolder}\" || true'",
"forwardPorts": [
8787
],
"portsAttributes": {
"8787": {
"label": "Headroom proxy",
"onAutoForward": "notify"
}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"charliermarsh.ruff",
"ms-azuretools.vscode-docker",
"GitHub.vscode-github-actions"
],
"settings": {
"editor.formatOnSave": true,
"files.eol": "\n",
"python.analysis.typeCheckingMode": "basic",
"python.defaultInterpreterPath": "/home/vscode/.venvs/headroom/bin/python",
"python.terminal.activateEnvironment": false,
"python.testing.pytestArgs": [
"tests"
],
"python.testing.pytestEnabled": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
}
}
}