docs(devcontainer): migrate from Docker to Dev Container workflow#195
Merged
MRNIU merged 1 commit intoSimple-XX:mainfrom Mar 19, 2026
Merged
docs(devcontainer): migrate from Docker to Dev Container workflow#195MRNIU merged 1 commit intoSimple-XX:mainfrom
MRNIU merged 1 commit intoSimple-XX:mainfrom
Conversation
- Add .devcontainer/Dockerfile with GCC 14 cross-compilation toolchains - Update devcontainer.json to build from local Dockerfile with VS Code settings - Rewrite docs/docker.md as Dev Container guide (VS Code, Codespaces, CLI) - Update README.md, README_ENG.md, docs/0_工具链.md: Docker → Dev Container Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
There was a problem hiding this comment.
Pull request overview
This PR migrates the project’s developer-environment documentation and configuration from a manual Docker workflow to a Dev Container-based workflow (VS Code / Codespaces / devcontainer CLI), aiming to make environment setup more declarative and one-click.
Changes:
- Added a new
.devcontainer/Dockerfileand updated.devcontainer/devcontainer.jsonto build the dev environment locally via Dev Container. - Rewrote
docs/docker.mdinto Dev Container usage documentation (VS Code, Codespaces, CLI). - Updated
README.md/README_ENG.mdwording from Docker-centric setup to Dev Container-centric setup.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
docs/docker.md |
Replaces Docker manual steps with Dev Container usage instructions and build/run commands. |
README.md |
Updates “Engineering Infrastructure” and environment setup docs to Dev Container workflow. |
README_ENG.md |
English counterpart of the README Dev Container migration. |
.devcontainer/devcontainer.json |
Switches from prebuilt image to local Dockerfile build; sets C/C++ standards and extensions. |
.devcontainer/Dockerfile |
Defines an Ubuntu-based toolchain container with QEMU, GDB, CMake, and cross-compilers. |
| @@ -0,0 +1,71 @@ | |||
| # Copyright The SimpleKernel Contributors | |||
|
|
|||
| FROM ubuntu:latest | |||
Comment on lines
+7
to
+8
| RUN apt-get update && apt-get upgrade -y && \ | ||
| apt-get install --no-install-recommends --fix-missing -y \ |
Comment on lines
214
to
227
| ```shell | ||
| # 1. 克隆项目 | ||
| git clone https://github.com/simple-xx/SimpleKernel.git | ||
| cd SimpleKernel | ||
| git submodule update --init --recursive | ||
|
|
||
| # 2. 启动开发环境 | ||
| docker pull ptrnull233/simple_kernel:latest | ||
| docker run --name SimpleKernel-dev -itd -p 233:22 \ | ||
| -v $(pwd):/root/SimpleKernel ptrnull233/simple_kernel:latest | ||
| # 2. 使用 VS Code 打开并在容器中重新打开 | ||
| # 安装 Dev Containers 扩展后,点击左下角 >< 图标 | ||
| # 选择 "Reopen in Container" | ||
|
|
||
| # 3. 进入开发容器 | ||
| docker exec -it SimpleKernel-dev /bin/zsh | ||
| # 或使用 CLI | ||
| npm install -g @devcontainers/cli | ||
| devcontainer up --workspace-folder . | ||
| devcontainer exec --workspace-folder . bash | ||
| ``` |
Comment on lines
215
to
228
| ```shell | ||
| # 1. Clone the project | ||
| git clone https://github.com/simple-xx/SimpleKernel.git | ||
| cd SimpleKernel | ||
| git submodule update --init --recursive | ||
|
|
||
| # 2. Start development environment | ||
| docker pull ptrnull233/simple_kernel:latest | ||
| docker run --name SimpleKernel-dev -itd -p 233:22 \ | ||
| -v $(pwd):/root/SimpleKernel ptrnull233/simple_kernel:latest | ||
| # 2. Open in VS Code and reopen in container | ||
| # Install Dev Containers extension, click the >< icon at bottom-left | ||
| # Select "Reopen in Container" | ||
|
|
||
| # 3. Enter development container | ||
| docker exec -it SimpleKernel-dev /bin/zsh | ||
| # Or use CLI | ||
| npm install -g @devcontainers/cli | ||
| devcontainer up --workspace-folder . | ||
| devcontainer exec --workspace-folder . bash | ||
| ``` |
Comment on lines
21
to
30
| ```shell | ||
| # 通过 SSH 连接到容器(首次需要密码) | ||
| ssh -p 233 zone@localhost | ||
| # 默认密码:zone | ||
| # 安装 devcontainer CLI | ||
| npm install -g @devcontainers/cli | ||
|
|
||
| # 在容器内创建 SSH 目录和授权文件 | ||
| mkdir -p /home/zone/.ssh | ||
| touch /home/zone/.ssh/authorized_keys | ||
| chmod 700 /home/zone/.ssh | ||
| chmod 600 /home/zone/.ssh/authorized_keys | ||
| # 构建并启动 | ||
| devcontainer up --workspace-folder . | ||
|
|
||
| # 将本地公钥内容添加到 authorized_keys | ||
| # 可以通过 docker exec 或直接编辑文件 | ||
| # 在容器内执行命令 | ||
| devcontainer exec --workspace-folder . cmake --preset=build_x86_64 | ||
| ``` |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
.devcontainer/Dockerfile:基于 Ubuntu,包含 GCC 14 全架构交叉编译工具链(x86_64/riscv64/aarch64/arm)、QEMU、CMake、GDB 等.devcontainer/devcontainer.json:从预构建镜像切换为本地 Dockerfile 构建,添加 VS Code C++23/C23 配置和精简的扩展列表docs/docker.md:从 Docker 手动操作指南改为 Dev Container 文档,覆盖 VS Code / GitHub Codespaces / CLI 三种使用方式README.md、README_ENG.md、docs/0_工具链.md:所有 Docker 相关描述统一迁移为 Dev ContainerMotivation
旧的 Docker 工作流需要手动
docker pull/run、配置 SSH、端口映射等步骤。Dev Container 提供声明式配置,VS Code 一键打开、Codespaces 零配置,大幅降低环境搭建门槛。