Skip to content

Commit 56b6621

Browse files
authored
Merge pull request #10 from codebytes/aspire-updates
Add initial .NET Aspire solution with AppHost and Web projects
2 parents 0923ca9 + 318bdda commit 56b6621

40 files changed

+1412
-7
lines changed

.aspire/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"appHostPath": "../src/aspire/DevContainers.Aspire.AppHost/DevContainers.Aspire.AppHost.csproj"
3+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": ".NET Aspire",
3+
// Base .NET 9 image. Alternatively a Dockerfile/compose could be used.
4+
"image": "mcr.microsoft.com/devcontainers/dotnet:9.0-bookworm",
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
7+
"ghcr.io/devcontainers/features/powershell:1": {}
8+
},
9+
10+
// Install Aspire tooling & workloads early in create lifecycle.
11+
// (Previous postCreateCommand replaced by onCreateCommand as requested.)
12+
// Former: "postCreateCommand": "dotnet workload install aspire && dotnet restore <project>"
13+
"onCreateCommand": "curl -sSL https://aspire.dev/install.sh | bash",
14+
// Trust HTTPS dev certs on each container start (may be a no-op in headless Linux but harmless).
15+
"postStartCommand": "dotnet dev-certs https --trust || true",
16+
17+
"customizations": {
18+
"vscode": {
19+
"extensions": [
20+
"ms-dotnettools.csdevkit",
21+
"GitHub.copilot-chat",
22+
"GitHub.copilot"
23+
]
24+
}
25+
},
26+
"forwardPorts": [5087],
27+
"portsAttributes": {
28+
"5087": { "label": "DevContainers.Aspire.Web", "onAutoForward": "openBrowser" }
29+
},
30+
"remoteUser": "vscode"
31+
}

.github/copilot-instructions.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
# Copilot Project Instructions
3+
4+
This repository contains two main areas:
5+
6+
1. **Marp Slide Deck & Static Site** (for "The Power of Dev Containers and GitHub Codespaces")
7+
2. **.NET Aspire Sample Solution** (under `src/aspire/`)
8+
9+
---
10+
11+
## 1. Marp Slide Deck & Static Site
12+
13+
- **Source:** `slides/Slides.md` (single source of truth; always edit here)
14+
- **Assets:** `slides/img/` (images), `slides/themes/` (custom Marp CSS themes)
15+
- **Dev Containers:** `.devcontainer/slides/devcontainer.json` (authoring), `.devcontainer/codespaces/devcontainer.json` (lightweight demo)
16+
- **Build/Deploy:** `.github/workflows/marp-pages.yml` (renders Slides.md to `build/index.html` for GitHub Pages)
17+
18+
**Editing/Rendering:**
19+
- Retain the Marp front-matter block at the top of Slides.md
20+
- Use Marp directives (theme, footer, bg, columns) for layout
21+
- Add images to `slides/img/` and reference as `img/name.png`
22+
- Prefer custom theme files over inline styles
23+
24+
**Multi-deck:**
25+
- Add new decks as `slides/AnotherTalk.md` and update workflow to render
26+
27+
**Local Preview:**
28+
```bash
29+
docker run --rm -v "$PWD:/work" -w /work ghcr.io/marp-team/marp-cli/marp-cli --theme-set slides/themes -o build/index.html --html slides/Slides.md
30+
```
31+
32+
---
33+
34+
## 2. .NET Aspire Sample Solution (`src/aspire/`)
35+
36+
**Architecture:**
37+
- `DevContainers.Aspire.AppHost/`: Orchestrator using .NET Aspire hosting model; launches and manages the web project and any future services
38+
- `DevContainers.Aspire.Web/`: Minimal ASP.NET Core API (expandable)
39+
- `DevContainers.Aspire.ServiceDefaults/`: Shared service defaults (if present)
40+
41+
**Build/Run Workflow:**
42+
- Restore all projects: `dotnet restore`
43+
- Run orchestrator: `dotnet run --project DevContainers.Aspire.AppHost/DevContainers.Aspire.AppHost.csproj`
44+
- The AppHost will launch the Web project and any additional services
45+
- Default web endpoint: http://localhost:5087 (see console output for port)
46+
47+
**Dev Container Usage:**
48+
- Use `.devcontainer/aspire/devcontainer.json` for Aspire development
49+
- Key tasks:
50+
- `onCreateCommand`: Installs Aspire tooling/workloads
51+
- `postStartCommand`: Trusts HTTPS dev certs (safe on Linux)
52+
- Installs .NET Dev Kit, Copilot, Copilot Chat extensions
53+
- To start: open `src/aspire/` in VS Code, run "Dev Containers: Reopen in Container", select aspire config
54+
55+
**Docker Strategies:**
56+
- Docker-in-Docker (DinD): Full isolation, used by default for CI/Codespaces
57+
- Docker-on-Docker (DoD): Faster, shares host Docker socket; enable by mounting `/var/run/docker.sock` in devcontainer config
58+
- See `src/aspire/README.md` for tradeoffs and details
59+
60+
**Extending:**
61+
- Add new services (e.g., databases) via AppHost project
62+
- Extend the devcontainer image as needed for extra tools
63+
64+
**Patterns/Conventions:**
65+
- Multiple devcontainer configs under `.devcontainer/` (pattern: `.devcontainer/<name>/devcontainer.json`)
66+
- All slide content and images are managed in `slides/` (never edit `build/` directly)
67+
- Aspire solution is intentionally minimal; expand by adding new projects/services under `src/aspire/`
68+
69+
---
70+
71+
## General Guidance
72+
- Keep changes tightly scoped (content vs. infra)
73+
- Never commit real secrets; placeholder secrets in devcontainer configs are for demo only
74+
- No backend/server code outside `src/aspire/` unless intentionally expanding scope
75+
76+
---
77+
78+
## Key References
79+
- [Dev Containers Docs](https://code.visualstudio.com/docs/devcontainers/create-dev-container)
80+
- [Aspire Docs](https://learn.microsoft.com/dotnet/aspire/overview/)
81+
- [Marp CLI](https://marp.app/)
82+
83+
---
84+
85+
Let me know if any section needs elaboration (e.g., multi-deck support, theme authoring, or extending the workflow) and I can refine further.

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"sarif-viewer.connectToGithubCodeScanning": "off"
3+
}

0 commit comments

Comments
 (0)