-
Notifications
You must be signed in to change notification settings - Fork 101
Adopt Devcontainer for Development Environment #81
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
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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-bullseye", | ||
"features": { | ||
"ghcr.io/devcontainers/features/node:1": {}, | ||
"ghcr.io/devcontainers/features/python:1": { | ||
"version": "3.10", | ||
"toolsToInstall": "uv" | ||
} | ||
}, | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"editor.formatOnSave": true, | ||
"[rust]": { | ||
"editor.defaultFormatter": "rust-lang.rust-analyzer" | ||
} | ||
} | ||
} | ||
}, | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "uv venv" | ||
// Use 'mounts' to make the cargo cache persistent in a Docker Volume. | ||
// "mounts": [ | ||
// { | ||
// "source": "devcontainer-cargo-cache-${devcontainerId}", | ||
// "target": "/usr/local/cargo", | ||
// "type": "volume" | ||
// } | ||
// ] | ||
// 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": [], | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
## Development with Dev Container and GitHub Codespaces | ||
|
||
This repository provides a Dev Container to easily set up a development environment. Using Dev Container allows you to work in a consistent development environment with pre-configured dependencies and tools, whether locally or in the cloud with GitHub Codespaces. | ||
|
||
### Prerequisites | ||
|
||
**For Local Development:** | ||
|
||
* [Docker Desktop](https://www.docker.com/products/docker-desktop/) or any other compatible container runtime (e.g., Podman, OrbStack) installed. | ||
* [Visual Studio Code](https://code.visualstudio.com/) with the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) installed. | ||
|
||
**For GitHub Codespaces:** | ||
|
||
* A GitHub account. | ||
|
||
### Starting Dev Container | ||
|
||
**Using Visual Studio Code (Local):** | ||
|
||
1. Clone the repository. | ||
2. Open the repository in Visual Studio Code. | ||
3. Open the command palette in Visual Studio Code (`Ctrl + Shift + P` or `Cmd + Shift + P`) and execute `Dev Containers: Reopen in Container`. | ||
|
||
**Using GitHub Codespaces (Cloud):** | ||
|
||
1. Navigate to the repository on GitHub. | ||
2. Click the "<> Code" button. | ||
3. Select the "Codespaces" tab. | ||
4. Click "Create codespace on main" (or your desired branch). | ||
|
||
### Dev Container Configuration | ||
|
||
Dev Container settings are configured in `.devcontainer/devcontainer.json`. In this file, you can set the Docker image to use, extensions to install, port forwarding, and more. This configuration is used both for local development and GitHub Codespaces. | ||
|
||
### Development | ||
|
||
Once the Dev Container is started, you can proceed with development as usual. The container already has the necessary tools and libraries installed. In GitHub Codespaces, you will have a fully configured VS Code in your browser or desktop application. | ||
|
||
### Stopping Dev Container | ||
|
||
**Using Visual Studio Code (Local):** | ||
|
||
To stop the Dev Container, open the command palette in Visual Studio Code and execute `Remote: Close Remote Connection`. | ||
|
||
**Using GitHub Codespaces (Cloud):** | ||
|
||
GitHub Codespaces will automatically stop after a period of inactivity. You can also manually stop the codespace from the Codespaces menu in GitHub. | ||
|
||
### More Information | ||
|
||
* [Visual Studio Code Dev Containers](https://code.visualstudio.com/docs/remote/containers) | ||
* [Dev Container Specification](https://containers.dev/implementors/json_reference/) | ||
* [GitHub Codespaces](https://github.com/features/codespaces) | ||
|
||
This document describes the basic usage of Dev Container and GitHub Codespaces. Add project-specific settings and procedures as needed. |
Oops, something went wrong.
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.
Hi @jokemanfire, I've created a dedicated document for Dev Container setup in
docs/DEVCONTAINER.md
as we discussed. I've also added a link to it in the README.md. Could you please take a look and let me know if you have any feedback?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.
thks , and pls add a link in root's readme.
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.
Thank you for your feedback.
The link to the Dev Container documentation has already been added to the project root's README.md, under the "Development with Dev Container" section.
Please take a look at it here: https://github.com/Z9RTM/rust-sdk/tree/devcontainer?tab=readme-ov-file#development-with-dev-container
If you still can't find it or have any further questions, please let me know.