diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..3b1fb2ecc2 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,7 @@ +FROM mcr.microsoft.com/devcontainers/rust:1 + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + just cmake + +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index df354c9552..95aa97710c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,17 +2,16 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/rust { "name": "Rust", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/rust:latest", + "build": { + "dockerfile": "Dockerfile" + }, "features": { - // add `just` for running scripts - "ghcr.io/guiyomh/features/just:0": { + "ghcr.io/devcontainers/features/sshd:1": {}, + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers/features/github-cli:1": { "version": "latest" }, - // add `cargo-binstall` for installing other tools. - "ghcr.io/lee-orr/rusty-dev-containers/cargo-binstall:0": { - "version": "latest" - } + "ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {} }, // Configure tool-specific properties. "customizations": { @@ -27,15 +26,16 @@ ] } }, + "containerEnv": { + "CLAUDE_CONFIG_DIR": "/home/vscode/.claude", + "npm_config_store_dir": "/home/vscode/.local/share/pnpm" + }, - // Use 'mounts' to make the cargo cache persistent in a Docker Volume. - // "mounts": [ - // { - // "source": "devcontainer-cargo-cache-${devcontainerId}", - // "target": "/usr/local/cargo", - // "type": "volume" - // } - // ] + "mounts": [ + "source=${localEnv:HOME}/.claude,target=/home/vscode/.claude,type=bind", + "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,readonly", + "source=target,target=${containerWorkspaceFolder}/target,type=volume" + ], // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, @@ -44,7 +44,5 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "just init" - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" + "postCreateCommand": "/bin/bash .devcontainer/postCreateCommand.sh" } diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100644 index 0000000000..32d8a41b51 --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -eu + +sudo chown -R "$(whoami)" "$(pwd)/target" + +# cargo binstall (NOTE: update the commit when the script changes) +curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/3b64237893f03d6cce15ff4c5163026b681d5f9e/install-from-binstall-release.sh | bash + +npm i -g @withgraphite/graphite-cli + +just init