Skip to content

Commit 62c92c2

Browse files
authored
Add devcontainer to this repo (#740)
* Add devcontainer to this repo Fixes #739 Add devcontainer configuration to the repository to enable running samples via Codespaces. * **Add `.devcontainer/devcontainer.json`**: - Set the `name` to ".NET Aspire Samples". - Use the `image` "mcr.microsoft.com/devcontainers/dotnet:dev-9.0-bookworm". - Add necessary `features` for the devcontainer. - Add `customizations` for VS Code extensions and settings. - Set `onCreateCommand` to "dotnet restore". - Set `postStartCommand` to "dotnet dev-certs https --trust". - Configure `remoteEnv` for the PATH. * **Update `README.md`**: - Add a section about using devcontainer and Codespaces to run the samples. - Provide instructions on how to set up and use the devcontainer. - Include steps for setting up Devcontainer and using GitHub Codespaces. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/dotnet/aspire-samples/issues/739?shareId=XXXX-XXXX-XXXX-XXXX). * Add devcontainer configuration and update README.md * **.devcontainer/devcontainer.json**: Add a new devcontainer configuration file with the specified settings, features, and customizations for VS Code. * **README.md**: Add a section about using devcontainer and Codespaces, including instructions on how to set up and use the devcontainer. * Add `devcontainer.json` file with configuration for .NET Aspire Samples * **Configuration** - Set `name` to ".NET Aspire Samples" - Set `image` to "mcr.microsoft.com/devcontainers/dotnet:dev-9.0-bookworm" - Add necessary `features` for the devcontainer - Add `customizations` for VS Code extensions and settings - Set `dotnet.defaultSolution` to "samples/AspireShop/AspireShop.sln" - Remove `remoteEnv` PATH setting * Updates based ondotnet/aspire-devcontainer * Updated to use aspire-devcontainer-feature/dotnetaspire
1 parent 21a4142 commit 62c92c2

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": ".NET Aspire Samples",
3+
"image": "mcr.microsoft.com/devcontainers/dotnet:dev-9.0-bookworm",
4+
"features": {
5+
"ghcr.io/devcontainers/features/azure-cli:1": {},
6+
"ghcr.io/azure/azure-dev/azd:0": {},
7+
"ghcr.io/devcontainers/features/docker-in-docker": {},
8+
"ghcr.io/dotnet/aspire-devcontainer-feature/dotnetaspire:1": {},
9+
"ghcr.io/devcontainers/features/node:1": {},
10+
"ghcr.io/devcontainers/features/python:1": {}
11+
},
12+
"hostRequirements": {
13+
"cpus": 8,
14+
"memory": "32gb",
15+
"storage": "64gb"
16+
},
17+
"customizations": {
18+
"vscode": {
19+
"extensions": [
20+
"ms-azuretools.azure-dev",
21+
"GitHub.copilot",
22+
"GitHub.copilot-chat"
23+
],
24+
"settings": {
25+
"remote.autoForwardPorts": true,
26+
"remote.autoForwardPortsSource": "hybrid",
27+
"remote.otherPortsAttributes": {
28+
"onAutoForward": "ignore"
29+
},
30+
"dotnet.defaultSolution": "samples/AspireShop/AspireShop.sln"
31+
}
32+
}
33+
},
34+
"postStartCommand": "dotnet dev-certs https --trust"
35+
}

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,31 @@ We welcome contributions to this repository of samples related to official .NET
5050
## Code of conduct
5151

5252
This project has adopted the code of conduct defined by the [Contributor Covenant](https://contributor-covenant.org) to clarify expected behavior in our community. For more information, see the [.NET Foundation Code of Conduct](https://www.dotnetfoundation.org/code-of-conduct).
53+
54+
## Using Devcontainer and Codespaces
55+
56+
This repository includes a devcontainer configuration to help you quickly set up a development environment using Visual Studio Code and GitHub Codespaces.
57+
58+
### Setting up Devcontainer
59+
60+
1. **Install Visual Studio Code**: If you haven't already, download and install [Visual Studio Code](https://code.visualstudio.com/).
61+
62+
2. **Install Dev Containers extension**: Open Visual Studio Code and go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window. Search for "Dev Containers" and install the extension.
63+
64+
3. **Clone the repository**: Clone this repository to your local machine.
65+
66+
4. **Open the repository in Visual Studio Code**: Open Visual Studio Code and use the `File > Open Folder` menu to open the folder where you cloned this repository.
67+
68+
5. **Reopen in Container**: Once the repository is open, you should see a notification prompting you to reopen the folder in a container. Click the "Reopen in Container" button. If you don't see the notification, you can also use the `Remote-Containers: Reopen in Container` command from the Command Palette (Ctrl+Shift+P).
69+
70+
### Using GitHub Codespaces
71+
72+
1. **Open the repository on GitHub**: Navigate to this repository on GitHub.
73+
74+
2. **Create a Codespace**: Click the "Code" button and then click the "Open with Codespaces" tab. Click the "New codespace" button to create a new Codespace.
75+
76+
3. **Wait for the Codespace to start**: GitHub will set up a new Codespace with the devcontainer configuration defined in this repository. This may take a few minutes.
77+
78+
4. **Start coding**: Once the Codespace is ready, you can start coding directly in your browser or open the Codespace in Visual Studio Code.
79+
80+
The devcontainer configuration includes all the necessary tools and dependencies to run the samples in this repository. You can start coding and running the samples without having to install anything else on your local machine.

0 commit comments

Comments
 (0)