Skip to content

Commit 17b93e4

Browse files
committed
[fix] Modify Dockerfile to fix ci errors.
1 parent 6d41c23 commit 17b93e4

File tree

5 files changed

+123
-93
lines changed

5 files changed

+123
-93
lines changed

.github/workflows/docker-build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ jobs:
5252
- os_version: centos7
5353
build_mode: full
5454
display_name: "CentOS 7 (Full)"
55+
56+
# CentOS Stream 8 - Minimal mode
57+
- os_version: centos8
58+
build_mode: minimal
59+
display_name: "CentOS Stream 8 (Minimal)"
60+
61+
# CentOS Stream 8 - Full mode
62+
- os_version: centos8
63+
build_mode: full
64+
display_name: "CentOS Stream 8 (Full)"
5565

5666
name: Build & Test - ${{ matrix.display_name }}
5767

Dockerfile

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ENV DEBIAN_FRONTEND=noninteractive
2020

2121
# Configure package manager sources based on distribution
2222
RUN if [ "${DISTRO_NAME}" = "ubuntu" ]; then \
23+
# Use Tsinghua mirror
2324
sed -i 's@http://archive.ubuntu.com/@http://mirrors.tuna.tsinghua.edu.cn/@g' /etc/apt/sources.list || \
2425
sed -i 's@http://archive.ubuntu.com/@http://mirrors.tuna.tsinghua.edu.cn/@g' /etc/apt/sources.list.d/ubuntu.sources; \
2526
sed -i 's@http://security.ubuntu.com/@http://mirrors.tuna.tsinghua.edu.cn/@g' /etc/apt/sources.list || \
@@ -30,9 +31,21 @@ fi
3031
RUN if [ "${DISTRO_NAME}" = "ubuntu" ]; then \
3132
apt update && apt install -y ca-certificates && update-ca-certificates; \
3233
elif [ "${DISTRO_NAME}" = "centos" ]; then \
33-
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
34-
-e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' \
35-
-i.bak /etc/yum.repos.d/CentOS-*.repo || true; \
34+
# CentOS 7 is EOL, use Tsinghua vault repositories
35+
if grep -q "CentOS Linux release 7" /etc/centos-release 2>/dev/null || [ "${DISTRO_VERSION}" = "7" ]; then \
36+
sed -i \
37+
-e 's|^mirrorlist=|#mirrorlist=|g' \
38+
-e 's|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009|g' \
39+
-e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/7.9.2009|g' \
40+
/etc/yum.repos.d/CentOS-*.repo; \
41+
else \
42+
# CentOS Stream 8 - use Tsinghua vault path
43+
sed -i \
44+
-e 's|^mirrorlist=|#mirrorlist=|g' \
45+
-e 's|^#baseurl=http://mirror.centos.org/\$contentdir/\$stream|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/8-stream|g' \
46+
-e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/8-stream|g' \
47+
/etc/yum.repos.d/CentOS-Stream-*.repo; \
48+
fi; \
3649
yum install -y ca-certificates && update-ca-trust; \
3750
fi
3851

@@ -63,7 +76,7 @@ RUN if [ "${DISTRO_NAME}" = "ubuntu" ]; then \
6376
locales \
6477
tldr \
6578
net-tools telnet iputils-ping \
66-
unzip p7zip-full 7zip \
79+
unzip p7zip-full \
6780
ffmpeg jq poppler-utils imagemagick \
6881
ripgrep \
6982
tmux \
@@ -80,9 +93,20 @@ fi
8093

8194
# Install development tools
8295
RUN if [ "${DISTRO_NAME}" = "ubuntu" ]; then \
96+
# Select libstdc++ version based on Ubuntu version
97+
if [ "${DISTRO_VERSION}" = "20.04" ]; then \
98+
LIBSTDCXX_PKG="libstdc++-9-dev"; \
99+
elif [ "${DISTRO_VERSION}" = "22.04" ]; then \
100+
LIBSTDCXX_PKG="libstdc++-12-dev"; \
101+
elif [ "${DISTRO_VERSION}" = "24.04" ]; then \
102+
LIBSTDCXX_PKG="libstdc++-13-dev"; \
103+
else \
104+
LIBSTDCXX_PKG="libstdc++-12-dev"; \
105+
fi; \
83106
apt install -y \
84107
gcc \
85-
libstdc++-12-dev \
108+
g++ \
109+
${LIBSTDCXX_PKG} \
86110
cmake \
87111
make \
88112
ninja-build \
@@ -100,13 +124,11 @@ elif [ "${DISTRO_NAME}" = "centos" ]; then \
100124
gcc gcc-c++ \
101125
cmake3 \
102126
make \
103-
ninja-build \
104127
automake \
105128
autoconf \
106129
libtool \
107130
pkgconfig \
108131
gmp-devel \
109-
libyaml-devel \
110132
mpfr-devel; \
111133
fi
112134

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ A customized Docker development environment with pre-installed development tools
1717
**📚 Documentation:**
1818
- [Quick Start Guide](docs/QUICKSTART.md) - Get started in 3 steps
1919
- [Configuration Examples](docs/EXAMPLES.md) - Detailed configuration examples
20-
- [中文文档](README.zh-CN.md) - Chinese documentation
2120

2221
---
2322

README.zh-CN.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ This repository provides a highly customizable Docker-based development environm
1717
**📚 文档导航:**
1818
- [快速入门指南](docs/QUICKSTART.md) - 3步快速开始
1919
- [配置示例](docs/EXAMPLES.md) - 详细配置示例
20-
- [English Documentation](README.md) - 英文文档
2120

2221
---
2322

docs/EXAMPLES.md

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,201 +1,201 @@
1-
# dev-docker 配置示例
1+
# dev-docker 配置示例 / Configuration Examples
22

3-
## 快速开始示例
3+
## 快速开始示例 / Quick Start Examples
44

5-
### 1. 默认配置(推荐)
5+
### 1. 默认配置(推荐) / Default Configuration (Recommended)
66
```bash
7-
# Ubuntu 22.04 + 完整模式
7+
# Ubuntu 22.04 + 完整模式 / Ubuntu 22.04 + Full mode
88
./setup.sh
99
```
1010

11-
### 2. 不同操作系统版本
11+
### 2. 不同操作系统版本 / Different OS Versions
1212

13-
#### Ubuntu 20.04(精简模式)
13+
#### Ubuntu 20.04(精简模式) / Ubuntu 20.04 (Minimal)
1414
```bash
1515
./setup.sh -o ubuntu2004 -m minimal -b
1616
```
1717

18-
#### Ubuntu 24.04(完整模式)
18+
#### Ubuntu 24.04(完整模式) / Ubuntu 24.04 (Full)
1919
```bash
2020
./setup.sh -o ubuntu2404 -m full -b
2121
```
2222

23-
#### CentOS 7(完整模式)
23+
#### CentOS 7(完整模式) / CentOS 7 (Full)
2424
```bash
2525
./setup.sh -o centos7 -m full -b
2626
```
2727

28-
#### CentOS Stream 8(精简模式)
28+
#### CentOS Stream 8(精简模式) / CentOS Stream 8 (Minimal)
2929
```bash
3030
./setup.sh -o centos8 -m minimal -b
3131
```
3232

33-
### 3. 构建模式对比
33+
### 3. 构建模式对比 / Build Mode Comparison
3434

35-
#### 完整模式(full)- 适合完整开发
35+
#### 完整模式(full)- 适合完整开发 / Full Mode - For Complete Development
3636
```bash
3737
./setup.sh -m full -b
3838
```
39-
- 包含 LLVM/Clang 18
39+
- 包含 LLVM/Clang 18 / Includes LLVM/Clang 18
4040
- ZSH + Oh My Zsh
4141
- Miniconda
42-
- 所有开发工具
43-
- 镜像大小:~2-3GB
44-
- 构建时间:~10-15分钟
42+
- 所有开发工具 / All development tools
43+
- 镜像大小:~2-3GB / Image size: ~2-3GB
44+
- 构建时间:~10-15分钟 / Build time: ~10-15 minutes
4545

46-
#### 精简模式(minimal)- 适合快速开发/CI
46+
#### 精简模式(minimal)- 适合快速开发/CI / Minimal Mode - For Quick Development/CI
4747
```bash
4848
./setup.sh -m minimal -b
4949
```
50-
- 基础开发工具(gcc、git、cmake)
50+
- 基础开发工具(gcc、git、cmake) / Basic dev tools (gcc, git, cmake)
5151
- Bash shell
52-
- 无 LLVM/Clang
53-
- 无 Miniconda
54-
- 镜像大小:~800MB-1GB
55-
- 构建时间:~5-8分钟
52+
- 无 LLVM/Clang / No LLVM/Clang
53+
- 无 Miniconda / No Miniconda
54+
- 镜像大小:~800MB-1GB / Image size: ~800MB-1GB
55+
- 构建时间:~5-8分钟 / Build time: ~5-8 minutes
5656

57-
### 4. 常用操作
57+
### 4. 常用操作 / Common Operations
5858

5959
```bash
60-
# 列出可用的 OS 版本
60+
# 列出可用的 OS 版本 / List available OS versions
6161
./setup.sh -l
6262

63-
# 查看当前配置
63+
# 查看当前配置 / View current configuration
6464
./setup.sh -c
6565

66-
# 仅运行容器(不重新构建)
66+
# 仅运行容器(不重新构建) / Run container only (without rebuilding)
6767
./setup.sh -r
6868

69-
# 查询容器 IP
69+
# 查询容器 IP / Query container IP
7070
./setup.sh -i
7171

72-
# 停止并删除容器
72+
# 停止并删除容器 / Stop and remove container
7373
./setup.sh -s
7474
```
7575

76-
### 5. 代理配置
76+
### 5. 代理配置 / Proxy Configuration
7777

7878
```bash
79-
# 构建时使用代理
79+
# 构建时使用代理 / Use proxy during build
8080
export HTTP_PROXY="http://proxy.example.com:8080"
8181
export HTTPS_PROXY="http://proxy.example.com:8080"
8282
./setup.sh -b
8383

84-
# 或者在容器内配置代理
84+
# 或者在容器内配置代理 / Or configure proxy inside container
8585
docker exec -it dev_ubuntu2204_full_sheen bash
8686
cd ~/scripts
8787
./set_proxy.sh -s http://proxy.example.com:8080
8888
```
8989

90-
### 6. 多容器管理
90+
### 6. 多容器管理 / Multi-Container Management
9191

92-
你可以同时运行不同配置的容器:
92+
你可以同时运行不同配置的容器: / You can run containers with different configurations simultaneously:
9393

9494
```bash
95-
# 构建 Ubuntu 22.04 完整模式
95+
# 构建 Ubuntu 22.04 完整模式 / Build Ubuntu 22.04 full mode
9696
./setup.sh -o ubuntu2204 -m full -b
97-
# 容器名: dev_ubuntu2204_full_sheen
97+
# 容器名 / Container name: dev_ubuntu2204_full_sheen
9898

99-
# 构建 Ubuntu 22.04 精简模式
99+
# 构建 Ubuntu 22.04 精简模式 / Build Ubuntu 22.04 minimal mode
100100
./setup.sh -o ubuntu2204 -m minimal -b
101-
# 容器名: dev_ubuntu2204_minimal_sheen
101+
# 容器名 / Container name: dev_ubuntu2204_minimal_sheen
102102

103-
# 构建 CentOS 8 完整模式
103+
# 构建 CentOS 8 完整模式 / Build CentOS 8 full mode
104104
./setup.sh -o centos8 -m full -b
105-
# 容器名: dev_centos8_full_sheen
105+
# 容器名 / Container name: dev_centos8_full_sheen
106106
```
107107

108-
每个配置会创建独立的镜像和容器互不冲突。
108+
每个配置会创建独立的镜像和容器,互不冲突。 / Each configuration creates independent images and containers without conflicts.
109109

110-
### 7. 工作区目录结构
110+
### 7. 工作区目录结构 / Workspace Directory Structure
111111

112112
```
113113
~/workspace/
114-
├── dev_ubuntu2204_full_sheen/ # Ubuntu 22.04 完整模式工作区
115-
├── dev_ubuntu2204_minimal_sheen/ # Ubuntu 22.04 精简模式工作区
116-
├── dev_ubuntu2404_full_sheen/ # Ubuntu 24.04 完整模式工作区
117-
└── dev_centos8_full_sheen/ # CentOS 8 完整模式工作区
114+
├── dev_ubuntu2204_full_sheen/ # Ubuntu 22.04 完整模式工作区 / Full mode workspace
115+
├── dev_ubuntu2204_minimal_sheen/ # Ubuntu 22.04 精简模式工作区 / Minimal mode workspace
116+
├── dev_ubuntu2404_full_sheen/ # Ubuntu 24.04 完整模式工作区 / Full mode workspace
117+
└── dev_centos8_full_sheen/ # CentOS 8 完整模式工作区 / Full mode workspace
118118
```
119119

120-
### 8. 实际应用场景
120+
### 8. 实际应用场景 / Real-World Use Cases
121121

122-
#### 场景 1:C++ 开发(推荐完整模式)
122+
#### 场景 1:C++ 开发(推荐完整模式) / Scenario 1: C++ Development (Full Mode Recommended)
123123
```bash
124124
./setup.sh -o ubuntu2204 -m full -b
125-
# 使用 LLVM/Clang 进行现代 C++ 开发
125+
# 使用 LLVM/Clang 进行现代 C++ 开发 / Use LLVM/Clang for modern C++ development
126126
```
127127

128-
#### 场景 2:Python 数据科学(推荐完整模式)
128+
#### 场景 2:Python 数据科学(推荐完整模式) / Scenario 2: Python Data Science (Full Mode Recommended)
129129
```bash
130130
./setup.sh -o ubuntu2404 -m full -b
131-
# 使用 Miniconda 管理 Python 环境
131+
# 使用 Miniconda 管理 Python 环境 / Use Miniconda to manage Python environments
132132
```
133133

134-
#### 场景 3:CI/CD 流水线(推荐精简模式)
134+
#### 场景 3:CI/CD 流水线(推荐精简模式) / Scenario 3: CI/CD Pipeline (Minimal Mode Recommended)
135135
```bash
136136
./setup.sh -o ubuntu2204 -m minimal -b
137-
# 快速构建,体积小,适合 CI/CD
137+
# 快速构建,体积小,适合 CI/CD / Fast build, small size, suitable for CI/CD
138138
```
139139

140-
#### 场景 4:传统企业环境(CentOS)
140+
#### 场景 4:传统企业环境(CentOS) / Scenario 4: Traditional Enterprise Environment (CentOS)
141141
```bash
142142
./setup.sh -o centos7 -m full -b
143-
# 兼容企业级 CentOS 环境
143+
# 兼容企业级 CentOS 环境 / Compatible with enterprise CentOS environments
144144
```
145145

146-
### 9. SSH 连接
146+
### 9. SSH 连接 / SSH Connection
147147

148148
```bash
149-
# 获取容器 IP
149+
# 获取容器 IP / Get container IP
150150
./setup.sh -i
151151

152-
# SSH 连接(输出会显示具体命令)
152+
# SSH 连接(输出会显示具体命令) / SSH connection (output will show the exact command)
153153
ssh sheen@<container_ip>
154-
# 默认密码:123456
154+
# 默认密码 / Default password:123456
155155
```
156156

157-
### 10. 自定义配置
157+
### 10. 自定义配置 / Customization
158158

159-
编辑 `setup.sh` 顶部的变量:
159+
编辑 `setup.sh` 顶部的变量: / Edit variables at the top of `setup.sh`:
160160

161161
```bash
162-
# 修改容器用户名
162+
# 修改容器用户名 / Change container username
163163
container_user_name="your_username"
164164

165-
# 修改密码
165+
# 修改密码 / Change password
166166
container_passwd="your_secure_password"
167167

168-
# 修改工作区目录
168+
# 修改工作区目录 / Change workspace directory
169169
workspace_dir="/path/to/your/workspace"
170170
```
171171

172-
## 支持的操作系统版本详情
172+
## 支持的操作系统版本详情 / Supported OS Version Details
173173

174-
| OS 版本 | 支持的构建模式 | 特殊说明 |
174+
| OS 版本 / OS Version | 支持的构建模式 / Supported Build Modes | 特殊说明 / Notes |
175175
|---------|---------------|---------|
176-
| ubuntu2004 | minimal, full | LTS 长期支持 |
177-
| ubuntu2204 | minimal, full | 默认版本,LTS |
178-
| ubuntu2404 | minimal, full | 最新 LTS |
179-
| centos7 | minimal, full | 企业级稳定版 |
176+
| ubuntu2004 | minimal, full | LTS 长期支持 / LTS long-term support |
177+
| ubuntu2204 | minimal, full | 默认版本,LTS / Default version, LTS |
178+
| ubuntu2404 | minimal, full | 最新 LTS / Latest LTS |
179+
| centos7 | minimal, full | 企业级稳定版 / Enterprise stable version |
180180
| centos8 | minimal, full | CentOS Stream |
181181

182-
## 注意事项
182+
## 注意事项 / Important Notes
183183

184-
1. **精简模式限制**
185-
- 不支持 LLVM/Clang
186-
- 不支持 ZSH(使用 Bash)
187-
- 不包含 Miniconda
184+
1. **精简模式限制 / Minimal Mode Limitations**
185+
- 不支持 LLVM/Clang / No LLVM/Clang support
186+
- 不支持 ZSH(使用 Bash) / No ZSH support (uses Bash)
187+
- 不包含 Miniconda / Does not include Miniconda
188188

189-
2. **CentOS 特殊说明**
190-
- CentOS 7 使用 CentOS 官方源
191-
- CentOS 8 使用 CentOS Stream 8
192-
- 某些包名可能与 Ubuntu 不同
189+
2. **CentOS 特殊说明 / CentOS Special Notes**
190+
- CentOS 7 使用 CentOS 官方源 / CentOS 7 uses CentOS official sources
191+
- CentOS 8 使用 CentOS Stream 8 / CentOS 8 uses CentOS Stream 8
192+
- 某些包名可能与 Ubuntu 不同 / Some package names may differ from Ubuntu
193193

194-
3. **镜像和容器命名**
195-
- 镜像名:`dev_<os_version>_<mode>_<host_user>`
196-
- 容器名:`dev_<os_version>_<mode>_<container_user>`
194+
3. **镜像和容器命名 / Image and Container Naming**
195+
- 镜像名 / Image name`dev_<os_version>_<mode>_<host_user>`
196+
- 容器名 / Container name`dev_<os_version>_<mode>_<container_user>`
197197

198-
4. **多版本共存**
199-
- 不同配置的容器可以同时运行
200-
- 每个容器有独立的工作区目录
201-
- 注意不要混淆不同容器的配置
198+
4. **多版本共存 / Multi-Version Coexistence**
199+
- 不同配置的容器可以同时运行 / Containers with different configurations can run simultaneously
200+
- 每个容器有独立的工作区目录 / Each container has its own workspace directory
201+
- 注意不要混淆不同容器的配置 / Be careful not to confuse configurations of different containers

0 commit comments

Comments
 (0)