-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Rust toolchain to devcontainer #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,66 +1,58 @@ | ||
| FROM mcr.microsoft.com/devcontainers/base:ubuntu | ||
|
|
||
| RUN apt-get update && apt-get install -y curl git alsa-utils sox \ | ||
| RUN apt-get update && apt-get install -y curl git alsa-utils sox build-essential pkg-config libssl-dev libasound2-dev \ | ||
| && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | ||
| && apt-get install -y nodejs | ||
|
|
||
| # Install pnpm | ||
| RUN npm install -g pnpm | ||
|
|
||
| # Setup pnpm for vscode user and install global packages | ||
| USER vscode | ||
| ENV SHELL=/bin/bash | ||
| ENV PNPM_HOME="/home/vscode/.local/share/pnpm" | ||
| ENV PATH="${PNPM_HOME}:${PATH}" | ||
| ENV RUSTUP_HOME="/home/vscode/.rustup" | ||
| ENV CARGO_HOME="/home/vscode/.cargo" | ||
| ENV PATH="${CARGO_HOME}/bin:${PNPM_HOME}:${PATH}" | ||
| RUN bash -c "pnpm setup" \ | ||
| && echo "export PNPM_HOME=\"/home/vscode/.local/share/pnpm\"" >> /home/vscode/.bashrc \ | ||
| && echo "export PATH=\"\$PNPM_HOME:\$PATH\"" >> /home/vscode/.bashrc \ | ||
| && echo "export RUSTUP_HOME=\"/home/vscode/.rustup\"" >> /home/vscode/.bashrc \ | ||
| && echo "export CARGO_HOME=\"/home/vscode/.cargo\"" >> /home/vscode/.bashrc \ | ||
| && echo "export PATH=\"\$CARGO_HOME/bin:\$PATH\"" >> /home/vscode/.bashrc \ | ||
| && curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain stable \ | ||
| && bash -lc "rustup component add rustfmt clippy" \ | ||
| && bash -c "source /home/vscode/.bashrc && pnpm add -g supabase" | ||
|
|
||
| # Switch back to root for remaining operations | ||
| USER root | ||
|
|
||
| # Install global packages | ||
| RUN npm install -g typescript eslint @anthropic-ai/claude-code @openai/codex vercel | ||
|
|
||
| # Install Cursor Agent | ||
| RUN cargo install similarity-ts | ||
|
|
||
|
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix root-owned Cargo install into /home/vscode cargo install currently runs as root while CARGO_HOME=/home/vscode/.cargo, creating root-owned files the vscode user cannot manage. -RUN cargo install similarity-ts
+USER vscode
+# Install as non-root to keep ~/.cargo owned by vscode and lock deps for reproducibility
+RUN bash -lc 'cargo install --locked similarity-ts'
+USER root🤖 Prompt for AI Agents |
||
| USER vscode | ||
| RUN curl https://cursor.com/install -fsS | bash \ | ||
| && echo 'export PATH="$HOME/.local/bin:$PATH"' >> /home/vscode/.bashrc | ||
| USER root | ||
|
|
||
| # Git aliases for common commands | ||
| RUN echo "alias gco='git checkout'" >> /home/vscode/.bashrc \ | ||
| && echo "alias gst='git status'" >> /home/vscode/.bashrc \ | ||
| && echo "alias gad='git add'" >> /home/vscode/.bashrc \ | ||
| && echo "alias gcm='git commit -m'" >> /home/vscode/.bashrc \ | ||
| && echo "alias gps='git push'" >> /home/vscode/.bashrc \ | ||
| && echo "alias gpl='git pull'" >> /home/vscode/.bashrc | ||
|
|
||
| # Setup directories | ||
| RUN mkdir -p /home/vscode/.claude /home/vscode/.cursor /home/vscode/.openai /home/vscode/.codex \ | ||
| && chown -R vscode:vscode /home/vscode/.claude /home/vscode/.cursor /home/vscode/.openai /home/vscode/.codex | ||
|
|
||
| # Copy default Claude settings | ||
| COPY --chown=vscode:vscode .devcontainer/claude-settings.json /home/vscode/.claude/settings.json | ||
|
|
||
| # Copy Codex configuration | ||
| COPY --chown=vscode:vscode .devcontainer/codex-config.json /home/vscode/.codex/config.json | ||
|
|
||
| # Copy Claude commands | ||
| COPY --chown=vscode:vscode .claude/commands /home/vscode/.claude/commands | ||
|
|
||
| # Copy Claude agents | ||
| COPY --chown=vscode:vscode .claude/agents /home/vscode/.claude/agents | ||
|
|
||
| # Change default shell to bash | ||
| RUN chsh -s /bin/bash vscode | ||
|
|
||
| # Setup .bash_profile | ||
| RUN echo 'source ~/.bashrc' >> /home/vscode/.bash_profile \ | ||
| && chown vscode:vscode /home/vscode/.bash_profile | ||
|
|
||
| # Husky用の設定 | ||
| COPY package.json package-lock.json /tmp/ | ||
| COPY .husky /tmp/.husky/ | ||
| RUN cd /tmp && npm ci && npm run prepare || true | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Global CARGO_HOME/RUSTUP_HOME point into /home/vscode
Setting these globally means subsequent root RUN steps may write root-owned files under /home/vscode. This interacts with the cargo install below.
Either (a) run all cargo/rustup operations as vscode, or (b) override/unset these ENV vars before running root-only steps. See fix on Lines 29-30.
🏁 Script executed:
Length of output: 2778
Run the
cargo installstep underUSER vscodeor clear CARGO_HOME/RUSTUP_HOME before switching to rootGlobal CARGO_HOME/RUSTUP_HOME persist into the root context, so the
RUN cargo install similarity-tson.devcontainer/Dockerfile(around lines 25–30) will write root-owned files into/home/vscode/.cargo. Either move thatRUNback underUSER vscodeor unset/override those ENV vars immediately before the root-level cargo install.🤖 Prompt for AI Agents