siked 23e64e129a API接入 1 year ago
..
config 23e64e129a API接入 1 year ago
context 9b9d504bb0 first commit 1 year ago
ctl 5bcbf21ae3 10-26 1 year ago
service bc65fd09b7 合并Tab 1 year ago
README.MD 9b9d504bb0 first commit 1 year ago
RunCode.go 9b9d504bb0 first commit 1 year ago
打包镜像.MD bc65fd09b7 合并Tab 1 year ago

README.MD

Cloud-Run-Code

在线运行代码 服务依赖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 : 为 languages 接口返回的列表
  • 请求体:具体代码

    {
    "lang": "{lang}",
    "message": "execute success",
    "result": "hello world"
    }
    

Ubuntu

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