20 lines433 B
package runner | |
| |
import ( | |
"strconv" | |
"time" | |
) | |
| |
type limits struct { | |
Wall time.Duration | |
Memory int // MB | |
Pids int | |
} | |
| |
// Limits apply to every run. | |
var Limits = limits{Wall: 5 * time.Second, Memory: 128, Pids: 64} | |
| |
func (l limits) DockerArgs() []string { | |
return []string{"run", "--rm", "-i", "--network=none", "--read-only", | |
"--memory=" + strconv.Itoa(l.Memory) + "m", "--pids-limit=" + strconv.Itoa(l.Pids), "--cpus=0.5"} | |
} |