🐳 限制 CPU 使用

This commit is contained in:
Liang Ding 2019-05-19 01:29:27 +08:00
parent ff3546a844
commit 7576910f43
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util
var cmd *exec.Cmd
if conf.Docker {
fileName := filepath.Base(filePath)
cmd = exec.Command("docker", "run", "--rm", "--cpus", "0.1", "--name", rid, "-v", filePath+":/"+fileName, conf.DockerImageGo, "/"+fileName)
cmd = exec.Command("docker", "run", "--rm", "--cpus", "0.05", "--name", rid, "-v", filePath+":/"+fileName, conf.DockerImageGo, "/"+fileName)
} else {
cmd = exec.Command(filePath)
curDir := filepath.Dir(filePath)