From 256311d0adb10e189f6cc519e32f125c4422368c Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Sat, 1 May 2021 00:06:33 +0000 Subject: [PATCH] stdlib: docker: run init commands without volumes mounted Signed-off-by: Solomon Hykes --- stdlib/docker/container.cue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/stdlib/docker/container.cue b/stdlib/docker/container.cue index da101a85..a5fefd44 100644 --- a/stdlib/docker/container.cue +++ b/stdlib/docker/container.cue @@ -110,14 +110,24 @@ import ( src: v.source } }, - // Execute setup commands, then main command - for cmd in setup + [command] { + // Execute setup commands, without volumes + for cmd in setup { op.#Exec & { args: [shell.path] + shell.args + [cmd] "env": env "dir": dir "always": always + } + }, + // Execute main command with volumes + if command != "" { + op.#Exec & { + args: [shell.path] + shell.args + [command] + "env": env + "dir": dir + "always": always mount: { + // FIXME: fix perf issue for _, v in volume if v.type == "cache" { "\(v.dest)": "cache" } @@ -133,9 +143,11 @@ import ( } } }, + // FIXME: is subdir deprecated by dagger.io/io.#Dir ? op.#Subdir & { dir: outputDir }, + // FIXME: is export deprecated by dagger.io/io.#File ? if export != null { op.#Export & { source: export.source