Skip to content

docs(devcontainer): migrate from Docker to Dev Container workflow#195

Merged
MRNIU merged 1 commit intoSimple-XX:mainfrom
MRNIU:docs/devcontainer
Mar 19, 2026
Merged

docs(devcontainer): migrate from Docker to Dev Container workflow#195
MRNIU merged 1 commit intoSimple-XX:mainfrom
MRNIU:docs/devcontainer

Conversation

@MRNIU
Copy link
Member

@MRNIU MRNIU commented Mar 19, 2026

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.mdREADME_ENG.mddocs/0_工具链.md:所有 Docker 相关描述统一迁移为 Dev Container

Motivation

旧的 Docker 工作流需要手动 docker pull/run、配置 SSH、端口映射等步骤。Dev Container 提供声明式配置,VS Code 一键打开、Codespaces 零配置,大幅降低环境搭建门槛。

- 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>
Copilot AI review requested due to automatic review settings March 19, 2026 07:01
@MRNIU MRNIU merged commit d4def7e into Simple-XX:main Mar 19, 2026
3 of 4 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/Dockerfile and updated .devcontainer/devcontainer.json to build the dev environment locally via Dev Container.
  • Rewrote docs/docker.md into Dev Container usage documentation (VS Code, Codespaces, CLI).
  • Updated README.md / README_ENG.md wording 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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants