Skip to content

Commit 9e3ec68

Browse files
author
ide-coder
committed
add docs
1 parent cf755a4 commit 9e3ec68

2 files changed

Lines changed: 138 additions & 14 deletions

File tree

AGENTS.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ ide-code-server/
3636
# 构建镜像
3737
docker build -t ide-code-server .
3838

39-
# 本地运行
39+
# 本地运行(最小配置)
4040
docker run -d \
4141
--name ide-code-server \
4242
-p 8080:8080 \
43-
-v $(pwd)/data:/home/coder \
43+
-v $(pwd)/project:/home/coder/project \
44+
-v $(pwd)/code-server:/home/coder/.local/share/code-server \
4445
-e PASSWORD=yourpassword \
4546
ide-code-server:latest
4647
```
@@ -97,15 +98,51 @@ Dockerfile 采用精心设计的分层结构以优化缓存效率:
9798
```
9899
/home/coder/
99100
├── project/ # 工作区(主要挂载点)
100-
├── .local/share/code-server/ # VS Code 扩展目录
101-
├── .m2/settings.xml # Maven 配置
101+
├── .local/share/code-server/ # VS Code 扩展和用户数据
102+
├── .local/share/pnpm/ # pnpm 包存储
103+
├── .m2/
104+
│ ├── settings.xml # Maven 配置
105+
│ └── repository/ # Maven 本地仓库
106+
├── .npm/ # npm 缓存
102107
├── .npmrc # npm 配置
103108
├── .gemrc # gem 配置
104109
├── .config/pip/pip.conf # pip 配置
105-
├── go/ # Go GOPATH
110+
├── .cache/
111+
│ ├── uv/ # uv 缓存
112+
│ └── pip/ # pip 缓存
113+
├── go/ # Go GOPATH(用户安装的包)
106114
└── .rbenv/ # Ruby 版本管理
107115
```
108116

117+
## 外部挂载支持
118+
119+
为提升开发体验,以下目录支持外部挂载以实现数据持久化:
120+
121+
| 容器路径 | 用途 | 挂载优势 |
122+
|----------|------|----------|
123+
| `/home/coder/project` | 工作区 | 代码持久化 |
124+
| `/home/coder/.local/share/code-server` | VS Code 数据 | 扩展和设置持久化 |
125+
| `/home/coder/.npm` | npm 缓存 | 避免重复下载 |
126+
| `/home/coder/.local/share/pnpm` | pnpm 存储 | 共享包存储 |
127+
| `/home/coder/go` | Go 包 | 持久化 go install 的包 |
128+
| `/home/coder/.cache/uv` | uv 缓存 | Python 包缓存 |
129+
| `/home/coder/.cache/pip` | pip 缓存 | pip 包缓存 |
130+
| `/home/coder/.m2/repository` | Maven 仓库 | Java 依赖缓存 |
131+
132+
### 推荐挂载配置
133+
134+
```bash
135+
docker run -d \
136+
--name ide-code-server \
137+
-p 8080:8080 \
138+
-v $(pwd)/project:/home/coder/project \
139+
-v $(pwd)/code-server:/home/coder/.local/share/code-server \
140+
-v $(pwd)/npm:/home/coder/.npm \
141+
-v $(pwd)/go:/home/coder/go \
142+
-e PASSWORD=yourpassword \
143+
ghcr.io/fjiayang/ide-code-server:latest
144+
```
145+
109146
## 开发约定
110147

111148
### Dockerfile 编写规范

README.md

Lines changed: 96 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A comprehensive development environment Docker image based on code-server, pre-c
1515
docker run -d \
1616
--name ide-code-server \
1717
-p 8080:8080 \
18-
-v $(pwd)/data:/home/coder \
18+
-v $(pwd)/project:/home/coder/project \
1919
-e PASSWORD=yourpassword \
2020
ghcr.io/your-username/ide-code-server:latest
2121
```
@@ -24,35 +24,122 @@ Access at http://localhost:8080
2424

2525
## Volume Mounts
2626

27-
| Container Path | Purpose |
28-
|----------------|---------|
29-
| `/home/coder` | User home directory (configs, caches) |
30-
| `/home/coder/project` | Workspace |
31-
| `/home/coder/.local/share/code-server` | VS Code extensions |
27+
### Recommended External Mounts
28+
29+
For better persistence and performance, mount these directories externally:
30+
31+
| Container Path | Purpose | Description |
32+
|----------------|---------|-------------|
33+
| `/home/coder/project` | Workspace | Main workspace directory |
34+
| `/home/coder/.local/share/code-server` | VS Code Data | Extensions, settings, and user data |
35+
| `/home/coder/.npm` | npm Cache | npm global cache |
36+
| `/home/coder/.local/share/pnpm` | pnpm Store | pnpm package store |
37+
| `/home/coder/go` | Go Packages | GOPATH for user-installed Go packages |
38+
| `/home/coder/.cache/uv` | uv Cache | uv Python package cache |
39+
| `/home/coder/.cache/pip` | pip Cache | pip package cache |
40+
| `/home/coder/.m2/repository` | Maven Repo | Maven local repository |
41+
42+
### Minimal Setup
43+
44+
```bash
45+
docker run -d \
46+
--name ide-code-server \
47+
-p 8080:8080 \
48+
-v $(pwd)/project:/home/coder/project \
49+
-v $(pwd)/code-server:/home/coder/.local/share/code-server \
50+
-e PASSWORD=yourpassword \
51+
ghcr.io/your-username/ide-code-server:latest
52+
```
53+
54+
### Full Setup with All Mounts
55+
56+
```bash
57+
docker run -d \
58+
--name ide-code-server \
59+
-p 8080:8080 \
60+
-v $(pwd)/project:/home/coder/project \
61+
-v $(pwd)/code-server:/home/coder/.local/share/code-server \
62+
-v $(pwd)/npm:/home/coder/.npm \
63+
-v $(pwd)/pnpm:/home/coder/.local/share/pnpm \
64+
-v $(pwd)/go:/home/coder/go \
65+
-v $(pwd)/cache/uv:/home/coder/.cache/uv \
66+
-v $(pwd)/cache/pip:/home/coder/.cache/pip \
67+
-v $(pwd)/m2:/home/coder/.m2/repository \
68+
-e PASSWORD=yourpassword \
69+
ghcr.io/your-username/ide-code-server:latest
70+
```
3271

3372
## Docker Compose
3473

74+
### Minimal Configuration
75+
3576
```yaml
3677
services:
3778
ide-code-server:
3879
image: ghcr.io/your-username/ide-code-server:latest
3980
volumes:
40-
- ./data:/home/coder
81+
- ./project:/home/coder/project
82+
- ./code-server:/home/coder/.local/share/code-server
4183
ports:
4284
- "8080:8080"
4385
environment:
4486
- PASSWORD=yourpassword
4587
restart: unless-stopped
4688
```
4789
90+
### Full Configuration with All Mounts
91+
92+
```yaml
93+
services:
94+
ide-code-server:
95+
image: ghcr.io/your-username/ide-code-server:latest
96+
volumes:
97+
# Workspace
98+
- ./project:/home/coder/project
99+
# VS Code extensions and settings
100+
- ./code-server:/home/coder/.local/share/code-server
101+
# Node.js package caches
102+
- ./npm:/home/coder/.npm
103+
- ./pnpm:/home/coder/.local/share/pnpm
104+
# Go packages (GOPATH)
105+
- ./go:/home/coder/go
106+
# Python package caches
107+
- ./cache/uv:/home/coder/.cache/uv
108+
- ./cache/pip:/home/coder/.cache/pip
109+
# Maven local repository
110+
- ./m2:/home/coder/.m2/repository
111+
ports:
112+
- "8080:8080"
113+
environment:
114+
- PASSWORD=yourpassword
115+
restart: unless-stopped
116+
```
117+
118+
## Benefits of External Mounts
119+
120+
1. **VS Code Extensions** (`/home/coder/.local/share/code-server`)
121+
- Extensions persist across container rebuilds
122+
- Share extensions between containers
123+
- Faster startup after rebuild
124+
125+
2. **Package Caches** (`/home/coder/.npm`, `/home/coder/.local/share/pnpm`, etc.)
126+
- Avoid re-downloading packages
127+
- Share caches between containers
128+
- Faster dependency installation
129+
130+
3. **Language Packages** (`/home/coder/go`, `/home/coder/.m2/repository`)
131+
- Persist globally installed packages
132+
- Go tools installed via `go install`
133+
- Maven dependencies cached locally
134+
48135
## Installed Languages
49136

50137
| Language | Version | Tools | Mirror |
51138
|----------|---------|-------|--------|
52139
| Go | 1.24.0 | gopls, delve, golangci-lint | goproxy.cn |
53140
| Python | 3.13 | uv, conda | pypi.tuna.tsinghua.edu.cn |
54141
| Node.js | 22 LTS | npm, pnpm, yarn | npmmirror |
55-
| JDK | 21 | Maven 3.9.9 | Aliyun |
142+
| JDK | 21 | Maven 3.9.11 | Aliyun |
56143
| Ruby | 3.4.1 | Rails, Bundler | Ruby China |
57144

58145
## Build
@@ -63,4 +150,4 @@ docker build -t ide-code-server .
63150

64151
## License
65152

66-
MIT
153+
MIT

0 commit comments

Comments
 (0)