siked 23e64e129a API接入 | 1 year ago | |
---|---|---|
.. | ||
config | 1 year ago | |
context | 1 year ago | |
ctl | 1 year ago | |
service | 1 year ago | |
README.MD | 1 year ago | |
RunCode.go | 1 year ago | |
打包镜像.MD | 1 year ago |
在线运行代码 服务依赖docker环境
go run main.go --port=端口号 --config=配置文件路径
编辑docker_config.json
文件 添加对应 key value 即可
{
"docker_runner": {
"go": {
"ext": "go",
"filename": "main.go",
"image": "golang:1.18.0-alpine3.15",
"cmd": "go run main.go"
}
}
}
docker_runner
字段说明
字段名 | 说明 |
---|---|
ext | 文件后续 |
filename | 容器中运行的文件名 |
image | 镜像名 |
cmd | 启动容器后运行的命令 |
获取所有支持的语言列表
GET /languages
[
"go",
"python",
"php",
"java",
"node"
]
POST /run?lang={lang}
请求体:具体代码
{
"lang": "{lang}",
"message": "execute success",
"result": "hello world"
}
Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
sudo vim /etc/default/grub 替换: GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1" sudo update-grub reboot