-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add devcontainer configuration #8213
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Adds basic devcontainer configuration using Microsoft's rust:1-1-bookworm container. The existing recommended extensions are included.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,40 @@ | ||||||||||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||||||||||||||
// 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:1-1-bookworm", | ||||||||||||||
Comment on lines
+5
to
+6
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. See note below about using a docker file
Suggested change
|
||||||||||||||
"customizations": { | ||||||||||||||
"vscode": { | ||||||||||||||
"extensions": [ | ||||||||||||||
// cspell:disable-next-line | ||||||||||||||
"foxundermoon.shell-format", | ||||||||||||||
"streetsidesoftware.code-spell-checker" | ||||||||||||||
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. I noticed that this seems to try to load the cspell config from |
||||||||||||||
] | ||||||||||||||
} | ||||||||||||||
}, | ||||||||||||||
|
||||||||||||||
// Use 'mounts' to make the cargo cache persistent in a Docker Volume. | ||||||||||||||
// "mounts": [ | ||||||||||||||
// { | ||||||||||||||
// "source": "devcontainer-cargo-cache-${devcontainerId}", | ||||||||||||||
// "target": "/usr/local/cargo", | ||||||||||||||
// "type": "volume" | ||||||||||||||
// } | ||||||||||||||
// ] | ||||||||||||||
Comment on lines
+17
to
+24
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. Turning this on seems fairly useful as it means that you can rebuild the devcontainer without having to redownload the crates all the time. Instead they're cached in a volume that is stored locally. This saves a fair bit of time. |
||||||||||||||
|
||||||||||||||
// Features to add to the dev container. More info: https://containers.dev/features. | ||||||||||||||
// "features": {}, | ||||||||||||||
|
||||||||||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||||||||||||||
// "forwardPorts": [], | ||||||||||||||
|
||||||||||||||
// Use 'postCreateCommand' to run commands after the container is created. | ||||||||||||||
"postCreateCommand": "./.devcontainer/postCreateCommand.sh" | ||||||||||||||
Comment on lines
+32
to
+33
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. It may be worth (from the perspective of the next user to use the dev container at least) using a dockerfile here instead of doing this post build. |
||||||||||||||
|
||||||||||||||
// Configure tool-specific properties. | ||||||||||||||
// "customizations": {}, | ||||||||||||||
|
||||||||||||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||||||||||||||
// "remoteUser": "root" | ||||||||||||||
Comment on lines
+38
to
+39
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. See note below about root user. |
||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
sudo apt update && sudo apt install -y --no-install-recommends \ | ||
clang | ||
Comment on lines
+3
to
+4
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. If moving this to a dockerfile, makes sure to also remove the cache to reduce the image size
Comment on lines
+1
to
+4
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. This should also probably clone the GNU coreutils as it takes a reasonable amount of time to clone, and a git fetch would likely be much faster. The expectation is that the repo ends up one level up from this workspace in /workspace/gnu git clone --recurse-submodules https://github.com/coreutils/coreutils.git "/workspaces/gnu" This either requires sudo or root as /workspace is 644 root:root. So it's likely easiest to run as root - unsure if that's a problem within a container. Obviously you wouldn't want this on a physical machine |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,8 @@ denoland | |
deque | ||
dequeue | ||
dev | ||
devcontainer | ||
devcontainers | ||
devs | ||
discoverability | ||
duplicative | ||
|
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.