stdlib: docker: run init commands without volumes mounted

Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
Solomon Hykes 2021-05-01 00:06:33 +00:00
parent 315068ed08
commit 256311d0ad

View File

@ -110,14 +110,24 @@ import (
src: v.source src: v.source
} }
}, },
// Execute setup commands, then main command // Execute setup commands, without volumes
for cmd in setup + [command] { for cmd in setup {
op.#Exec & { op.#Exec & {
args: [shell.path] + shell.args + [cmd] args: [shell.path] + shell.args + [cmd]
"env": env "env": env
"dir": dir "dir": dir
"always": always "always": always
}
},
// Execute main command with volumes
if command != "" {
op.#Exec & {
args: [shell.path] + shell.args + [command]
"env": env
"dir": dir
"always": always
mount: { mount: {
// FIXME: fix perf issue
for _, v in volume if v.type == "cache" { for _, v in volume if v.type == "cache" {
"\(v.dest)": "cache" "\(v.dest)": "cache"
} }
@ -133,9 +143,11 @@ import (
} }
} }
}, },
// FIXME: is subdir deprecated by dagger.io/io.#Dir ?
op.#Subdir & { op.#Subdir & {
dir: outputDir dir: outputDir
}, },
// FIXME: is export deprecated by dagger.io/io.#File ?
if export != null { if export != null {
op.#Export & { op.#Export & {
source: export.source source: export.source