Move core actions to a subpackage
Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
)
|
||||
|
||||
// Modular build API for Docker containers
|
||||
@@ -46,7 +47,7 @@ import (
|
||||
dest: string | *"/"
|
||||
|
||||
// Execute copy operation
|
||||
_copy: dagger.#Copy & {
|
||||
_copy: core.#Copy & {
|
||||
"input": input.rootfs
|
||||
"contents": contents
|
||||
"source": source
|
||||
@@ -83,7 +84,7 @@ import (
|
||||
label: [string]: string
|
||||
hosts: [string]: string
|
||||
|
||||
_build: dagger.#Dockerfile & {
|
||||
_build: core.#Dockerfile & {
|
||||
"source": source
|
||||
"auth": auth
|
||||
"dockerfile": dockerfile
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
// Root filesystem with exported file
|
||||
result: _export.output
|
||||
|
||||
_export: dagger.#Export & {
|
||||
_export: core.#Export & {
|
||||
"tag": tag
|
||||
input: image.rootfs
|
||||
config: image.config
|
||||
|
@@ -3,6 +3,7 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
)
|
||||
|
||||
// Download an image from a remote registry
|
||||
@@ -16,7 +17,7 @@ import (
|
||||
secret: dagger.#Secret
|
||||
}
|
||||
|
||||
_op: dagger.#Pull & {
|
||||
_op: core.#Pull & {
|
||||
"source": source
|
||||
if auth != _|_ {
|
||||
"auth": auth
|
||||
|
@@ -2,6 +2,7 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
)
|
||||
|
||||
// Upload an image to a remote repository
|
||||
@@ -21,7 +22,7 @@ import (
|
||||
// Image to push
|
||||
image: #Image
|
||||
|
||||
_push: dagger.#Push & {
|
||||
_push: core.#Push & {
|
||||
"dest": dest
|
||||
if auth != _|_ {
|
||||
"auth": auth
|
||||
|
@@ -4,6 +4,7 @@ import (
|
||||
"list"
|
||||
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
)
|
||||
|
||||
// Run a command in a container
|
||||
@@ -14,7 +15,7 @@ import (
|
||||
always: bool | *false
|
||||
|
||||
// Filesystem mounts
|
||||
mounts: [name=string]: dagger.#Mount
|
||||
mounts: [name=string]: core.#Mount
|
||||
|
||||
// Expose network ports
|
||||
// FIXME: investigate feasibility
|
||||
@@ -70,7 +71,7 @@ import (
|
||||
|
||||
// Add defaults to image config
|
||||
// This ensures these values are present
|
||||
_defaults: dagger.#Set & {
|
||||
_defaults: core.#Set & {
|
||||
"input": {
|
||||
entrypoint: []
|
||||
cmd: []
|
||||
@@ -81,7 +82,7 @@ import (
|
||||
}
|
||||
|
||||
// Override with user config
|
||||
_config: dagger.#Set & {
|
||||
_config: core.#Set & {
|
||||
input: _defaults.output
|
||||
config: {
|
||||
if entrypoint != _|_ {
|
||||
@@ -123,7 +124,7 @@ import (
|
||||
for path, _ in files {
|
||||
"\(path)": {
|
||||
contents: string & _read.contents
|
||||
_read: dagger.#ReadFile & {
|
||||
_read: core.#ReadFile & {
|
||||
input: _exec.output
|
||||
"path": path
|
||||
}
|
||||
@@ -139,7 +140,7 @@ import (
|
||||
for path, _ in directories {
|
||||
"\(path)": {
|
||||
contents: dagger.#FS & _subdir.output
|
||||
_subdir: dagger.#Subdir & {
|
||||
_subdir: core.#Subdir & {
|
||||
input: _exec.output
|
||||
"path": path
|
||||
}
|
||||
@@ -159,7 +160,7 @@ import (
|
||||
}
|
||||
|
||||
// Actually execute the command
|
||||
_exec: dagger.#Exec & {
|
||||
_exec: core.#Exec & {
|
||||
"input": input.rootfs
|
||||
"always": always
|
||||
"mounts": mounts
|
||||
@@ -167,7 +168,7 @@ import (
|
||||
workdir: _config.output.workdir
|
||||
user: _config.output.user
|
||||
"env": env
|
||||
// env may contain secrets so we can't use dagger.#Set
|
||||
// env may contain secrets so we can't use core.#Set
|
||||
if input.config.env != _|_ {
|
||||
for key, val in input.config.env {
|
||||
if env[key] == _|_ {
|
||||
|
@@ -2,6 +2,7 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
)
|
||||
|
||||
// Change image config
|
||||
@@ -12,7 +13,7 @@ import (
|
||||
// The image config to change
|
||||
config: dagger.#ImageConfig
|
||||
|
||||
_set: dagger.#Set & {
|
||||
_set: core.#Set & {
|
||||
"input": input.config
|
||||
"config": config
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
|
||||
"universe.dagger.io/alpine"
|
||||
"universe.dagger.io/docker"
|
||||
@@ -26,7 +27,7 @@ dagger.#Plan & {
|
||||
]
|
||||
}
|
||||
|
||||
verify: dagger.#ReadFile & {
|
||||
verify: core.#ReadFile & {
|
||||
input: image.output.rootfs
|
||||
path: "/test.txt"
|
||||
}
|
||||
@@ -59,7 +60,7 @@ dagger.#Plan & {
|
||||
]
|
||||
}
|
||||
|
||||
verify: dagger.#ReadFile & {
|
||||
verify: core.#ReadFile & {
|
||||
input: image.output.rootfs
|
||||
path: "/test.txt"
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
|
||||
@@ -16,7 +17,7 @@ dagger.#Plan & {
|
||||
source: dagger.#Scratch
|
||||
dockerfile: contents: """
|
||||
FROM alpine:3.15
|
||||
|
||||
|
||||
RUN echo -n hello world >> /test.txt
|
||||
"""
|
||||
},
|
||||
@@ -33,7 +34,7 @@ dagger.#Plan & {
|
||||
]
|
||||
}
|
||||
|
||||
verify: dagger.#ReadFile & {
|
||||
verify: core.#ReadFile & {
|
||||
input: build.output.rootfs
|
||||
path: "/test.txt"
|
||||
} & {
|
||||
@@ -58,7 +59,7 @@ dagger.#Plan & {
|
||||
]
|
||||
}
|
||||
|
||||
verify: dagger.#ReadFile & {
|
||||
verify: core.#ReadFile & {
|
||||
input: build.output.rootfs
|
||||
path: "/test.txt"
|
||||
} & {
|
||||
|
@@ -2,6 +2,7 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
|
||||
@@ -43,7 +44,7 @@ dagger.#Plan & {
|
||||
|
||||
// Test: image config behavior is correct
|
||||
config: {
|
||||
build: dagger.#Dockerfile & {
|
||||
build: core.#Dockerfile & {
|
||||
source: dagger.#Scratch
|
||||
dockerfile: contents: """
|
||||
FROM alpine:3.15.0
|
||||
@@ -71,7 +72,7 @@ dagger.#Plan & {
|
||||
contents: """
|
||||
#!/bin/sh
|
||||
echo -n "hello from $HELLO_FROM" > /dagger.txt
|
||||
|
||||
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package docker
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/alpine"
|
||||
@@ -24,7 +25,7 @@ dagger.#Plan & {
|
||||
}
|
||||
}
|
||||
|
||||
verify: dagger.#ReadFile & {
|
||||
verify: core.#ReadFile & {
|
||||
input: run.output.rootfs
|
||||
path: "/output.txt"
|
||||
}
|
||||
@@ -59,7 +60,7 @@ dagger.#Plan & {
|
||||
export: directories: "/test": _
|
||||
}
|
||||
|
||||
verify: dagger.#ReadFile & {
|
||||
verify: core.#ReadFile & {
|
||||
input: run.export.directories."/test"
|
||||
path: "/output.txt"
|
||||
}
|
||||
|
Reference in New Issue
Block a user