Skip to content

Commit a0dca70

Browse files
Add devcontainer configuration for development (#65)
This PR adds a devcontainer configuration that forwards common ports used during development including those for WebRTC. Installation of kraftkit and updating/upgrading occur on container creation using the `onCreateCommand` key. The latest Ubuntu LTS is used in an attempt to maintain some parity with the build pipeline. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Add VS Code devcontainer based on Ubuntu with Docker-in-Docker, Go/Node features, kraftkit install on create, and forwarded TCP/UDP ports (incl. WebRTC). > > - **Dev Environment**: > - **New `/.devcontainer/devcontainer.json`**: > - Base image `mcr.microsoft.com/devcontainers/base:ubuntu` with features: Docker-in-Docker, Go, Node (latest). > - `onCreateCommand`: apt setup, add Unikraft repo, install `kraftkit`, system upgrade. > - Forward ports: `444` (Kernel Images API), `8080` (Web Interface), `9222` (CDP); UDP range `56000-56100` for WebRTC. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d028f0e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --- <!-- mesa-description-start --> ## TL;DR Adds a devcontainer configuration to standardize the development environment. ## Why we made these changes To create a consistent development environment that mirrors the build pipeline, simplifies onboarding, and automates the installation of necessary tools like `kraftkit`. ## What changed? - Added `.devcontainer/devcontainer.json` to define the development environment. - The container is based on Ubuntu LTS and includes features for Docker-in-Docker, Go, and Node.js. - Uses `onCreateCommand` to automatically install `kraftkit` and run system updates on container creation. - Forwards TCP ports `444` (API), `8080` (Web), `9222` (CDP), and the UDP port range `56000-56100` for WebRTC. ## Validation - [ ] Devcontainer builds and starts successfully. - [ ] `kraftkit` is installed and available in the container's terminal. - [ ] Forwarded ports are accessible from the host machine. <sup>_Description generated by Mesa. [Update settings](https://app.mesa.dev/onkernel/settings/pull-requests)_</sup> <!-- mesa-description-end -->
1 parent 8248caf commit a0dca70

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "Kernel Devcontainer",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
6+
"ghcr.io/devcontainers/features/go:1": {},
7+
"ghcr.io/devcontainers/features/node:1": {
8+
"nodeGypDependencies": false,
9+
"version": "latest"
10+
}
11+
},
12+
"onCreateCommand": "sudo apt-get -y update && sudo apt-get -y install ca-certificates curl gnupg lsb-release && sudo mkdir -p /etc/apt/keyrings && curl -fsSL https://deb.pkg.kraftkit.sh/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/unikraft.gpg && echo \"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/unikraft.gpg] https://deb.pkg.kraftkit.sh /\" | sudo tee /etc/apt/sources.list.d/unikraft.list >/dev/null && sudo apt-get -y update && sudo apt-get -y install kraftkit && sudo apt-get -y upgrade",
13+
"forwardPorts": [
14+
444,
15+
8080,
16+
9222
17+
],
18+
"portsAttributes": {
19+
"444": {
20+
"label": "Kernel Images API",
21+
"onAutoForward": "notify"
22+
},
23+
"8080": {
24+
"label": "Web Interface (Neko WebRTC UI)",
25+
"onAutoForward": "notify"
26+
},
27+
"9222": {
28+
"label": "CDP (ncat Chromium)",
29+
"onAutoForward": "notify"
30+
}
31+
},
32+
// WebRTC UDP ports
33+
"appPort": [
34+
"56000-56100:56000-56100/udp"
35+
]
36+
}

0 commit comments

Comments
 (0)