Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM rust:1.95
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# Match a typical host Linux UID/GID (override in devcontainer.json "build" -> "args" if needed)
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=1000

ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo

RUN apt-get update && apt-get install -y --no-install-recommends \
sudo \
python3 \
python3-pip \
python3-matplotlib \
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash -m -u $USER_UID -g $USER_GID $USERNAME \
&& chown -R $USER_UID:$USER_GID $RUSTUP_HOME $CARGO_HOME \
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the default devcontainer configuration (mcr.microsoft.com/devcontainers/...) also does this.

&& chmod 440 /etc/sudoers.d/$USERNAME \
&& rm -rf /var/lib/apt/lists/*

USER $USERNAME
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "zip2",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"USER_UID": "1000",
"USER_GID": "1000"
Comment on lines +8 to +9
}
},
"postCreateCommand": "rustup component add rustfmt clippy",
"customizations": {
"codespaces": {
"openFiles": ["CONTRIBUTING.md", ".github/pull_request_template.md"]
},
"vscode": {
"extensions": [
"rust-lang.rust-analyzer"
]
}
Comment on lines +17 to +21
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To better align the development environment with the project's strict CI requirements (clippy and multi-feature support), consider adding the even-better-toml extension for Cargo.toml validation and configuring rust-analyzer to use clippy and enable all features by default. This helps contributors identify issues locally before submitting a pull request.

    "vscode": {
      "extensions": [
        "rust-lang.rust-analyzer",
        "tamasfe.even-better-toml"
      ],
      "settings": {
        "rust-analyzer.check.command": "clippy",
        "rust-analyzer.cargo.allFeatures": true
      }
    }

},
"remoteUser": "vscode",
"updateRemoteUserUID": false
}