mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-09-11 00:22:56 -05:00
Layer the frontend toolchain on top of the existing release builder image so a single container covers Go, C support-layer and web development, with the builder image remaining the single source of truth for the cross toolchain, Go and MaixCDK. - Mount the workspace at /home/build/NanoKVM, where the Makefile and support/sg2002/build expect it, and resync MaixCDK components via update_lib on create so C builds never use stale sources - Install Node from official dist tarballs (integrity-checked, pinned to the major used by CI), with NODE_DIST_MIRROR / NPM_REGISTRY / BASE_IMAGE build args for restrictive or mirrored corporate networks - Export the MaixCDK virtualenv via remoteEnv so non-interactive processes (tasks, extensions, exec) get it too; make updateRemoteUserUID explicit since the published builder image bakes the CI runner's uid - Run pnpm non-interactively during post-create (no TTY) and give the skeleton-less home a standard ~/.profile -> ~/.bashrc chain - Make the web toolchain convention explicit via package.json engines (Node >= 22, pnpm >= 11, matching CI) and document it in web/README - Document the dev container in the README, point server/README at the container flow that works on any host OS, and ignore .pnpm-store/
50 lines
1.8 KiB
JSON
50 lines
1.8 KiB
JSON
// Dev container for NanoKVM: Go cross-compilation, MaixCDK C support layer
|
|
// and web frontend in a single container. See "Development" in README.md.
|
|
{
|
|
"name": "NanoKVM",
|
|
"build": {
|
|
"dockerfile": "Dockerfile"
|
|
},
|
|
// The Makefile and support/sg2002/build expect the repository at
|
|
// ~/NanoKVM of the baked-in "build" user -- mount it exactly there.
|
|
"workspaceMount": "source=${localWorkspaceFolder},target=/home/build/NanoKVM,type=bind,consistency=cached",
|
|
"workspaceFolder": "/home/build/NanoKVM",
|
|
"remoteUser": "build",
|
|
// The published builder image bakes in the CI runner's uid (currently
|
|
// 1001); on Linux hosts this remaps "build" to the local uid so the bind
|
|
// mount stays writable. The remap chowns /home/build once, which makes
|
|
// the first container creation noticeably slower.
|
|
"updateRemoteUserUID": true,
|
|
// Equivalent of `. ~/MaixCDK/bin/activate` for every process spawned in
|
|
// the container, interactive or not (tasks, extensions, exec).
|
|
"remoteEnv": {
|
|
"VIRTUAL_ENV": "/home/build/MaixCDK",
|
|
"PATH": "/home/build/MaixCDK/bin:${containerEnv:PATH}"
|
|
},
|
|
"forwardPorts": [3001],
|
|
"portsAttributes": {
|
|
"3001": {
|
|
"label": "web dev server (vite)"
|
|
}
|
|
},
|
|
"postCreateCommand": ".devcontainer/post-create.sh",
|
|
// This configuration itself mounts nothing from the host (VS Code may
|
|
// still forward your SSH agent and git credentials by default). To use
|
|
// git over SSH or reach a NanoKVM device from inside the container,
|
|
// uncomment the mount below.
|
|
// "mounts": [
|
|
// "source=${localEnv:HOME}/.ssh,target=/home/build/.ssh,type=bind,readonly"
|
|
// ],
|
|
"customizations": {
|
|
"vscode": {
|
|
"extensions": [
|
|
"golang.go",
|
|
"ms-vscode.cpptools",
|
|
"dbaeumer.vscode-eslint",
|
|
"esbenp.prettier-vscode",
|
|
"bradlc.vscode-tailwindcss"
|
|
]
|
|
}
|
|
}
|
|
}
|