mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
feat(go): improve cold start of 200ms by building outside of nsjail
This commit is contained in:
@@ -58,38 +58,14 @@ mount {
|
||||
options: "size=500000000"
|
||||
}
|
||||
|
||||
|
||||
mount {
|
||||
src: "{JOB_DIR}/go.sum"
|
||||
dst: "/tmp/go/go.sum"
|
||||
src: "{JOB_DIR}/main"
|
||||
dst: "/tmp/go/main"
|
||||
is_bind: true
|
||||
mandatory: false
|
||||
}
|
||||
|
||||
mount {
|
||||
src: "{JOB_DIR}/go.mod"
|
||||
dst: "/tmp/go/go.mod"
|
||||
is_bind: true
|
||||
}
|
||||
|
||||
mount {
|
||||
src: "{JOB_DIR}/main.go"
|
||||
dst: "/tmp/go/main.go"
|
||||
is_bind: true
|
||||
mandatory: false
|
||||
}
|
||||
|
||||
mount {
|
||||
src: "{JOB_DIR}/inner/inner_main.go"
|
||||
dst: "/tmp/go/inner/inner_main.go"
|
||||
is_bind: true
|
||||
}
|
||||
|
||||
mount {
|
||||
src: "{JOB_DIR}/inner/runner.go"
|
||||
dst: "/tmp/go/inner/runner.go"
|
||||
is_bind: true
|
||||
}
|
||||
|
||||
mount {
|
||||
src: "{JOB_DIR}/args.json"
|
||||
dst: "/tmp/go/args.json"
|
||||
|
||||
@@ -1151,6 +1151,18 @@ func Run(req Req) (interface{{}}, error){{
|
||||
.replace("{SHARED_MOUNT}", shared_mount),
|
||||
)
|
||||
.await?;
|
||||
let build_go = Command::new(go_path)
|
||||
.current_dir(job_dir)
|
||||
.env_clear()
|
||||
.env("PATH", path_env)
|
||||
.env("BASE_INTERNAL_URL", base_internal_url)
|
||||
.env("GOPATH", GO_CACHE_DIR)
|
||||
.env("HOME", home_env)
|
||||
.args(vec!["build", "main.go"])
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()?;
|
||||
handle_child(&job.id, db, logs, timeout, build_go).await?;
|
||||
|
||||
Command::new(nsjail_path)
|
||||
.current_dir(job_dir)
|
||||
@@ -1158,14 +1170,7 @@ func Run(req Req) (interface{{}}, error){{
|
||||
.envs(reserved_variables)
|
||||
.env("PATH", path_env)
|
||||
.env("BASE_INTERNAL_URL", base_internal_url)
|
||||
.args(vec![
|
||||
"--config",
|
||||
"run.config.proto",
|
||||
"--",
|
||||
go_path,
|
||||
"run",
|
||||
"main.go",
|
||||
])
|
||||
.args(vec!["--config", "run.config.proto", "--", "/tmp/go/main"])
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()?
|
||||
|
||||
Reference in New Issue
Block a user