Add docker.#Set for updating image metadata
Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
This commit is contained in:
25
pkg/universe.dagger.io/docker/set.cue
Normal file
25
pkg/universe.dagger.io/docker/set.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger/engine"
|
||||
)
|
||||
|
||||
// Change image config
|
||||
#Set: {
|
||||
// The source image
|
||||
input: #Image
|
||||
|
||||
// The image config to change
|
||||
config: engine.#ImageConfig
|
||||
|
||||
_set: engine.#Set & {
|
||||
"input": input.config
|
||||
"config": config
|
||||
}
|
||||
|
||||
// Resulting image with the config changes
|
||||
output: #Image & {
|
||||
rootfs: input.rootfs
|
||||
config: _set.output
|
||||
}
|
||||
}
|
@@ -22,3 +22,7 @@ setup() {
|
||||
dagger up ./run-export-directory-test.cue
|
||||
dagger up ./image-config-test.cue
|
||||
}
|
||||
|
||||
@test "docker.#Set" {
|
||||
dagger up ./set.cue
|
||||
}
|
||||
|
40
pkg/universe.dagger.io/docker/test/set.cue
Normal file
40
pkg/universe.dagger.io/docker/test/set.cue
Normal file
@@ -0,0 +1,40 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
actions: {
|
||||
image: output: docker.#Image & {
|
||||
rootfs: engine.#Scratch
|
||||
config: {
|
||||
cmd: ["/bin/sh"]
|
||||
env: PATH: "/sbin:/bin"
|
||||
onbuild: ["COPY . /app"]
|
||||
}
|
||||
}
|
||||
set: docker.#Set & {
|
||||
input: image.output
|
||||
config: {
|
||||
env: FOO: "bar"
|
||||
workdir: "/root"
|
||||
onbuild: ["RUN /app/build.sh"]
|
||||
}
|
||||
}
|
||||
verify: set.output.config & {
|
||||
env: {
|
||||
PATH: "/sbin:/bin"
|
||||
FOO: "bar"
|
||||
}
|
||||
cmd: ["/bin/sh"]
|
||||
workdir: "/root"
|
||||
onbuild: [
|
||||
"COPY . /app",
|
||||
"RUN /app/build.sh",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user