Fix docker.#Run compatibility with docker.#Build

Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
This commit is contained in:
Helder Correia
2022-01-15 19:33:50 -01:00
parent 5016f4597d
commit 3956b8b59b
2 changed files with 28 additions and 19 deletions

View File

@@ -9,8 +9,16 @@ import (
// Run a command in a container
#Run: {
image: #Image
input: image // for compatibility with #Build
_image: #Image
{
image: #Image
_image: image
} | {
// For compatibility with #Build
input: #Image
_image: input
}
always: bool | *false
@@ -94,34 +102,35 @@ import (
message: string | *null
}
output?: {
// FIXME: hack for #Build compatibility
#Image
rootfs?: dagger.#FS & _exec.output
export: {
rootfs: dagger.#FS & _exec.output
files: [path=string]: {
contents: string
contents: _read.contents
_read: engine.#ReadFile & {
contents: string & _read.contents
_read: engine.#ReadFile & {
input: _exec.output
"path": path
}
}
directories: [path=string]: {
contents: dagger.#FS
contents: (dagger.#Subdir & {
contents: dagger.#FS & _subdir.output
_subdir: dagger.#Subdir & {
input: _exec.output
"path": path
}).output
}
}
}
}
// For compatibility with #Build
output: #Image & {
rootfs: _exec.output
config: _image.config
}
// Actually execute the command
_exec: engine.#Exec & {
args: [cmd.name] + cmd._flatFlags + cmd.args
input: image.rootfs
input: _image.rootfs
"mounts": mounts
"env": env
"workdir": workdir