Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
TommyTT
1024云IDE应用挑战赛
比较版本
9dd0d527bc843a2d700581c2a3a2544303d9a341...42338d6866ae2ce3af3471e2fc685495ef408a48
1024云IDE应用挑战赛
项目概览
TommyTT
/
1024云IDE应用挑战赛
该项目与 Fork 源项目分叉
Fork自
Cloud IDE / 1024云IDE应用挑战赛
通知
4
Star
20
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
1024云IDE应用挑战赛
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
源分支
42338d6866ae2ce3af3471e2fc685495ef408a48
选择Git版本
...
目标分支
9dd0d527bc843a2d700581c2a3a2544303d9a341
选择Git版本
比较
Commits (2)
https://gitcode.net/t1019256391/1024/-/commit/f652a87d3bbc9766ce0e6feed665377cb473de93
tag rename
2022-10-30T13:14:08+00:00
635677437d755007c09848d3
635677437d755007c09848d3@devide
https://gitcode.net/t1019256391/1024/-/commit/42338d6866ae2ce3af3471e2fc685495ef408a48
update
2022-10-30T13:17:09+00:00
635677437d755007c09848d3
635677437d755007c09848d3@devide
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
14 deletion
+8
-14
README.MD
README.MD
+1
-1
build.sh
build.sh
+1
-1
common.py
common.py
+4
-3
server.py
server.py
+2
-9
未找到文件。
README.MD
浏览文件 @
42338d68
...
...
@@ -21,7 +21,7 @@
-
未支持标准输入
-
stdout和stderr分开等等
![
image text
](
https://gitcode.net/t1019256391/1024/-/raw/main/static/pic1.jpg
)
# 如何添加想要支持的语言
非常简单,仅需2步
1.
在
`config`
目录下创建该语言的Dockerfile文件以及example文件
...
...
build.sh
浏览文件 @
42338d68
...
...
@@ -18,7 +18,7 @@ EOF
fi
# 其他镜像在python中异步创建
docker build
-f
config/python/Dockerfile
-t
python
.
docker build
-f
config/python/Dockerfile
-t
webcode:python-1.0
.
pip
install
-r
requirements
-i
https://mirrors.aliyun.com/pypi/simple/
python router.py
common.py
浏览文件 @
42338d68
...
...
@@ -2,7 +2,7 @@ import logging
import
os.path
from
typing
import
Dict
TAG_STR
=
"webcode
_{}:
1.0"
TAG_STR
=
"webcode
:{}-
1.0"
DOCKER_CONFIG_DIR
=
"config/{}"
from
docker
import
APIClient
...
...
@@ -38,7 +38,7 @@ class Language:
def
build_image
(
self
):
try
:
generator
=
low_level_client
.
build
(
path
=
DOCKER_CONFIG_DIR
.
format
(
self
.
name
),
tag
=
self
.
name
,
tag
=
TAG_STR
.
format
(
self
.
name
)
,
rm
=
True
,
decode
=
True
)
while
True
:
# 打印日志,防止build太久看不到进度条
...
...
@@ -49,7 +49,8 @@ class Language:
break
else
:
continue
print
(
"正在创建镜像"
,
self
.
name
,
output
.
get
(
"stream"
,
""
),
output
.
get
(
"status"
,
""
),
output
.
get
(
"progress"
,
""
))
print
(
"正在创建镜像"
,
self
.
name
,
output
.
get
(
"stream"
,
""
),
output
.
get
(
"status"
,
""
),
output
.
get
(
"progress"
,
""
))
except
StopIteration
:
print
(
"Docker image build complete."
)
return
True
...
...
server.py
浏览文件 @
42338d68
import
docker
import
os
import
json
import
logging
from
func_timeout
import
func_set_timeout
,
exceptions
from
docker.errors
import
ImageNotFound
import
time
import
threading
import
common
from
common
import
*
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -20,11 +13,11 @@ def get_and_set_image(name):
if
Languages
[
name
].
image
:
return
Languages
[
name
].
image
try
:
image
=
client
.
images
.
get
(
name
)
image
=
client
.
images
.
get
(
TAG_STR
.
format
(
name
)
)
Languages
[
name
].
set_image
(
image
)
return
image
except
ImageNotFound
:
logger
.
error
(
"找不到%s的镜像"
,
name
)
pass
return
None
...
...