diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..35138f9a6 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,23 @@ +FROM rust:1.95 + +# 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 \ + && chmod 440 /etc/sudoers.d/$USERNAME \ + && rm -rf /var/lib/apt/lists/* + +USER $USERNAME diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..9483a5c7f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +{ + "name": "zip2", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + "USER_UID": "1000", + "USER_GID": "1000" + } + }, + "postCreateCommand": "rustup component add rustfmt clippy", + "customizations": { + "codespaces": { + "openFiles": ["CONTRIBUTING.md", ".github/pull_request_template.md"] + }, + "vscode": { + "extensions": [ + "rust-lang.rust-analyzer" + ] + } + }, + "remoteUser": "vscode", + "updateRemoteUserUID": false +}