Skip to content

Commit e6f03fd

Browse files
authored
Merge pull request #17 from Coding/tanhehe/add_docker_support
add docker support
2 parents 5349d7b + 6e6320f commit e6f03fd

File tree

6 files changed

+327
-52
lines changed

6 files changed

+327
-52
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*/.idea/
2+
*/*.iml
3+
*.orig
4+
*/target/
5+
*.env
6+
**/*.db
7+
*/*.ipr
8+
*/*.iws
9+
.DS_Store
10+

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ksimple/java8-mvn-nodejs-npm-python3
2+
MAINTAINER tanhe123 from Coding IDE Team <[email protected]>
3+
4+
EXPOSE 8080
5+
6+
# Add user `coding`
7+
8+
RUN useradd --create-home --home-dir /home/coding --shell /usr/bin/bash coding \
9+
&& echo "coding:coding" | chpasswd \
10+
&& adduser coding sudo \
11+
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
12+
13+
USER coding
14+
15+
ADD . /opt/coding/WebIDE
16+
17+
RUN sudo chown -R coding /opt/coding/WebIDE
18+
19+
CMD ["/opt/coding/WebIDE/ide.sh", "build", "run"]

README-zh.md

Lines changed: 69 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Coding WebIDE
22

3+
README: [English](https://github.com/Coding/WebIDE/blob/master/README.md) | [中文](https://github.com/Coding/WebIDE/blob/master/README-zh.md)
4+
35
![](https://raw.githubusercontent.com/Coding/WebIDE/gh-pages/screenshots/import.png)
46

57
![](https://raw.githubusercontent.com/Coding/WebIDE/gh-pages/screenshots/workspace.png)
@@ -10,6 +12,7 @@ Coding WebIDE(https://ide.coding.net) 是 Coding 自主研发的在线集成开
1012

1113
请诸位把 issues 提到对应的项目下,这样可以得到更及时的处理。前端请到 [WebIDE-Frontend](https://github.com/Coding/WebIDE-Frontend/issues),后端请到 [WebIDE-Backend](https://github.com/Coding/WebIDE-Backend/issues).
1214

15+
1316
## 功能特色
1417

1518
1. *全功能 Web Terminal*
@@ -23,34 +26,83 @@ Coding WebIDE(https://ide.coding.net) 是 Coding 自主研发的在线集成开
2326
本项目是为了能够一键启动 `WebIDE` 开源版而创建的,以 git 子模块的形式引用了另外的三个项目,分别是 WebIDE-Frontend、WebIDE-Frontend-Webjars、WebIDE-Backend。
2427

2528

26-
2729
## 模块说明
2830

29-
> **WebIDE-Frontend:** WebIDE 前端项目
30-
> **WebIDE-Frontend-Webjars:** webjar 项目,用于将 WebIDE 前端打包成 webjar
31-
> **WebIDE-Backend:** WebIDE 后端项目
32-
33-
## Clone 项目
34-
35-
首先 clone 本项目到本地,然后拉取子项目:
36-
37-
> git submodule init
38-
> git submodule update
31+
* [WebIDE-Frontend](https://github.com/Coding/WebIDE-Frontend) WebIDE 前端项目
32+
* [WebIDE-Frontend-Webjars](https://github.com/Coding/WebIDE-Frontend-Webjars) webjar 项目,用于将 WebIDE 前端打包成 webjar
33+
* [WebIDE-Backend](https://github.com/Coding/WebIDE-Backend) WebIDE 后端项目
3934

40-
即可拉取子项目到本地。
4135

4236
## 运行环境
4337

44-
**WebIDE Frontend 依赖 npm 做包管理,wepack 和 babel 做构建工具**
45-
**WebIDE-Frontend-Webjars & WebIDE-Backend 项目依赖 maven**
38+
WebIDE Frontend 依赖 **npm** 做包管理,**webpack****babel** 做构建工具
39+
WebIDE-Frontend-Webjars & WebIDE-Backend 项目依赖 **maven3****java8**
4640

4741
在编译、运行项目前,请保证环境依赖已被正确配置。
4842

4943
## 编译、打包、运行
5044

45+
### 克隆项目
46+
47+
从 Coding 克隆项目:
48+
```
49+
git clone [email protected]:coding/WebIDE.git
50+
```
51+
52+
从 Github 克隆项目:
53+
```
54+
git clone [email protected]:Coding/WebIDE.git
55+
```
56+
57+
拉取子项目:
58+
```
59+
git submodule init
60+
git submodule update
61+
```
62+
63+
### 本机版
64+
5165
本项目提供了一个脚本 `ide.sh`,用于编译、打包、运行项目:
5266

53-
> **./ide.sh build:** 编译并打包前端项目
54-
> **./ide.sh run:** 启动项目
67+
```
68+
./ide.sh build # 编译并打包前端项目
69+
./ide.sh run # 启动项目
70+
```
71+
启动完成后,默认端口为 8080,访问 localhost:8080 即可。打开浏览器访问 http://localhost:8080
72+
73+
### Docker 版
74+
75+
#### 通过使用 ide.sh
76+
77+
```
78+
./ide.sh docker build # 创建 docker 镜像
79+
./ide.sh docker run # 创建并启动 container
80+
./ide.sh docker stop # 停止 container
81+
./ide.sh docker attach # attach container
82+
./ide.sh docker logs # 查看 container log
83+
./ide.sh docker exec # 进入 container
84+
```
85+
86+
#### 通过使用 docker 命令
87+
88+
如果在使用脚本的过程中遇到了困难,可以直接使用 docker 的命令。
89+
90+
```
91+
# 创建 docker 镜像
92+
docker build -t coding/webide
93+
94+
# 创建并启动 container
95+
docker run -p 8080:8080 -v $HOME/.m2:/home/coding/.m2 -v $HOME/.coding-ide-home:/home/coding/.coding-ide-home --name webide coding/webide
96+
97+
# 停止 container
98+
docker stop webide
99+
100+
# attach container
101+
docker attach webide
102+
103+
# 查看 container log
104+
docker logs webide
55105
56-
启动完成后,默认端口为 8080,访问 localhost:8080 即可。
106+
# 进入 container
107+
docker exec -it webide bash
108+
```

README.md

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Coding WebIDE
22

3+
README: [English](https://github.com/Coding/WebIDE/blob/master/README.md) | [中文](https://github.com/Coding/WebIDE/blob/master/README-zh.md)
4+
35
![](https://raw.githubusercontent.com/Coding/WebIDE/gh-pages/screenshots/import.png)
46

57
![](https://raw.githubusercontent.com/Coding/WebIDE/gh-pages/screenshots/workspace.png)
@@ -10,6 +12,7 @@ Coding WebIDE(https://ide.coding.net) is a cloud-based IDE developed by Coding T
1012

1113
Please submit issues to corresponding projects, that'll help us make issues tracking easier so that we can provide timely help to you. Submit frontend issues at [WebIDE-Frontend](https://github.com/Coding/WebIDE-Frontend/issues) and backend issues at [WebIDE-Backend](https://github.com/Coding/WebIDE-Backend/issues).
1214

15+
1316
## Features
1417

1518
1. *Built-In Terminal*
@@ -20,45 +23,89 @@ Please submit issues to corresponding projects, that'll help us make issues trac
2023
6. *VIM/Emacs Mode*
2124
7. *Previews*
2225

23-
[中文 README](https://github.com/Coding/WebIDE-Workspace/blob/master/README-zh.md)
24-
2526
This is the entry point to setup and run the WebIDE Community Edition project. It includes other 3 repos as git submodules.
2627

2728

29+
## Modules
30+
31+
* [WebIDE-Frontend](https://github.com/Coding/WebIDE-Frontend) contains frontend code.
32+
* [WebIDE-Frontend-Webjars](https://github.com/Coding/WebIDE-Frontend-Webjars) packs frontend to webjar.
33+
* [WebIDE-Backend](https://github.com/Coding/WebIDE-Backend) contains backend code.
2834

2935

30-
## Modules
36+
## Environment
37+
38+
WebIDE Frontend uses **npm** for package management, **webpack** and **babel** for building.
39+
Frontend Webjars & WebIDE Backend use **maven3** and **java8**.
40+
41+
Please ensure you have corresponding tools installed in your environment before build and run the project.
3142

32-
> [WebIDE-Frontend](https://github.com/Coding/WebIDE-Frontend) contains frontend code.
33-
> [WebIDE-Frontend-Webjars](https://github.com/Coding/WebIDE-Frontend-Webjars) packs frontend to webjar.
34-
> [WebIDE-Backend](https://github.com/Coding/WebIDE-Backend) contains backend code.
3543

44+
## Build and run
3645

37-
## How to clone
46+
### Clone the repo
3847

39-
Clone this git repo to local. Then do:
48+
Clone from coding.net:
49+
```
50+
git clone [email protected]:coding/WebIDE.git
51+
```
52+
Clone from github.com:
53+
```
54+
git clone [email protected]:Coding/WebIDE.git
55+
```
4056

57+
Init and pull submodules:
4158
```
4259
git submodule init
4360
git submodule update
4461
```
45-
4662
This will also clone the other 3 repos via git submodule mechanism.
4763

4864

49-
## Environment
65+
### Run on a normal host
5066

51-
WebIDE Frontend uses `npm` for package management, `webpack` and `babel` for building.
52-
WebIDE Frontend Webjars & WebIDE Backend use `maven`.
67+
We provide a shell script `ide.sh` to ease the process for you.
5368

54-
Please ensure you have corresponding tools installed in your environment before build and run the project.
69+
```
70+
./ide.sh build # transpile and pack the frontend to webjars
71+
./ide.sh run # start the backend server
72+
```
73+
Server runs on port 8080 by default, visit localhost:8080 to check it out.
5574

5675

57-
## Build and run
76+
### Run in a docker container
77+
78+
#### Using `ide.sh`
79+
80+
```
81+
./ide.sh docker build # create docker image
82+
./ide.sh docker run # create and start a container
83+
./ide.sh docker stop # stop container
84+
./ide.sh docker attach # attach container
85+
./ide.sh docker logs # check container's logs
86+
./ide.sh docker exec # create a new Bash session in the container
87+
```
88+
89+
#### Using `docker` CLI
90+
91+
If you encounter any problem using `ide.sh`, try get around it using docker CLI directly.
92+
93+
```
94+
# create docker image
95+
docker build -t coding/webide
96+
97+
# create and start a container
98+
docker run -p 8080:8080 -v $HOME/.m2:/home/coding/.m2 -v $HOME/.coding-ide-home:/home/coding/.coding-ide-home --name webide coding/webide
5899
59-
We provide a shell script `ide.sh` to ease the build and run process
100+
# stop container
101+
docker stop webide
60102
61-
> **./ide.sh build:** builds the frontend and packs to webjars
62-
> **./ide.sh run:** start the backend and server
103+
# attach container
104+
docker attach webide
63105
64-
Server runs on port 8080 by default, visit localhost:8080 to check it out. Have fun!
106+
# check container's logs
107+
docker logs webide
108+
109+
# create a new Bash session in the container
110+
docker exec -it webide bash
111+
```

0 commit comments

Comments
 (0)