Europa: docker: split in smaller files

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes 2022-01-07 04:53:29 +00:00 committed by Solomon Hykes
parent 7d96594283
commit 458d04819d
4 changed files with 93 additions and 74 deletions

View File

@ -0,0 +1,24 @@
package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
)
// A container image
#Image: {
// Root filesystem of the image.
rootfs: dagger.#FS
// Image config
config: engine.#ImageConfig
}
// A ref is an address for a remote container image
// Examples:
// - "index.docker.io/dagger"
// - "dagger"
// - "index.docker.io/dagger:latest"
// - "index.docker.io/dagger:latest@sha256:a89cb097693dd354de598d279c304a1c73ee550fbfff6d9ee515568e0c749cfe"
// FIXME: add formatting constraints
#Ref: engine.#Ref

View File

@ -0,0 +1,37 @@
// Build, ship and run Docker containers in Dagger
package docker
import (
"dagger.io/dagger/engine"
"dagger.io/dagger"
)
// Download an image from a remote registry
#Pull: {
// Source ref.
source: #Ref
// Registry authentication
// Key must be registry address, for example "index.docker.io"
auth: [registry=string]: {
username: string
secret: dagger.#Secret
}
_op: engine.#Pull & {
"source": source
"auth": [ for target, creds in auth {
"target": target
creds
}]
}
// Downloaded image
image: #Image & {
rootfs: _op.output
config: _op.config
}
// FIXME: compat with Build API
output: image
}

View File

@ -0,0 +1,31 @@
package docker
import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
)
// Upload an image to a remote repository
#Push: {
// Destination ref
dest: #Ref
// Complete ref after pushing (including digest)
result: #Ref & _push.result
// Registry authentication
// Key must be registry address
auth: [registry=string]: {
username: string
secret: dagger.#Secret
}
// Image to push
image: #Image
_push: engine.#Push & {
dest: dest
input: image.rootfs
config: image.config
}
}

View File

@ -1,22 +1,12 @@
// Build, ship and run Docker containers in Dagger
package docker
import (
"list"
"dagger.io/dagger/engine"
"dagger.io/dagger"
"dagger.io/dagger/engine"
)
// A container image
#Image: {
// Root filesystem of the image.
rootfs: dagger.#FS
// Image config
config: engine.#ImageConfig
}
// Run a command in a container
#Run: {
image: #Image
@ -138,66 +128,3 @@ import (
"user": user
}
}
// A ref is an address for a remote container image
// Examples:
// - "index.docker.io/dagger"
// - "dagger"
// - "index.docker.io/dagger:latest"
// - "index.docker.io/dagger:latest@sha256:a89cb097693dd354de598d279c304a1c73ee550fbfff6d9ee515568e0c749cfe"
#Ref: engine.#Ref
// Download an image from a remote registry
#Pull: {
// Source ref.
source: #Ref
// Registry authentication
// Key must be registry address, for example "index.docker.io"
auth: [registry=string]: {
username: string
secret: dagger.#Secret
}
_op: engine.#Pull & {
"source": source
"auth": [ for target, creds in auth {
"target": target
creds
}]
}
// Downloaded image
image: #Image & {
rootfs: _op.output
config: _op.config
}
// FIXME: compat with Build API
output: image
}
// Upload an image to a remote repository
#Push: {
// Destination ref
dest: #Ref
// Complete ref after pushing (including digest)
result: #Ref & _push.result
// Registry authentication
// Key must be registry address
auth: [registry=string]: {
username: string
secret: dagger.#Secret
}
// Image to push
image: #Image
_push: engine.#Push & {
dest: dest
input: image.rootfs
config: image.config
}
}