docker
This module supports publishing with multiple registry/tag references along withproviding Docker secrets and Build Args.
Installation
dagger install github.com/act3-ai/dagger/docker@v0.1.14Entrypoint
Return Type
Docker !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | top level source code directory |
Example
dagger -m github.com/act3-ai/dagger/docker@0b0aaef3b89117273914795c82e2eb9ea87a2448 call \
--src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Docker {
return dag.
Docker(src)
}@function
def example(src: dagger.Directory) -> dagger.Docker:
return (
dag.docker(src)
)@func()
example(src: Directory): Docker {
return dag
.docker(src)
}Types
Docker 🔗
build() 🔗
Build image from Dockerfile
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| dockerfile | String | "Dockerfile" | path of dockerfile to build with |
| target | String | "" | target stage of image build |
| platform | Scalar | - | platform to build with. value of [os]/[arch], example: linux/amd64, linux/arm64 defaults to the platform of the dagger engine |
Example
dagger -m github.com/act3-ai/dagger/docker@0b0aaef3b89117273914795c82e2eb9ea87a2448 call \
--src DIR_PATH buildfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Container {
return dag.
Docker(src).
Build()
}@function
def example(src: dagger.Directory) -> dagger.Container:
return (
dag.docker(src)
.build()
)@func()
example(src: Directory): Container {
return dag
.docker(src)
.build()
}publish() 🔗
Build a multi-arch image index from Dockerfile and Publish to an OCI registry, returning a slice of image digest references.
Return Type
[String ! ] !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| dockerfile | String ! | "Dockerfile" | path of dockerfile to build |
| address | String ! | - | registry address to publish to, without tag |
| tags | [String ! ] ! | - | tags to publish |
| target | String ! | "" | target stage of image build |
| platforms | [Scalar ! ] | - | platforms to build with. value of [os]/[arch], example: linux/amd64, linux/arm64 defaults to the platform of the dagger engine |
Example
dagger -m github.com/act3-ai/dagger/docker@0b0aaef3b89117273914795c82e2eb9ea87a2448 call \
--src DIR_PATH publish --dockerfile string --address string --tags string1 --tags string2 --target stringfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory, dockerfile string, address string, tags []string, target string) []string {
return dag.
Docker(src).
Publish(ctx, dockerfile, address, tags, target)
}@function
async def example(src: dagger.Directory, dockerfile: str, address: str, tags: List[str], target: str) -> List[str]:
return await (
dag.docker(src)
.publish(dockerfile, address, tags, target)
)@func()
async example(src: Directory, dockerfile: string, address: string, tags: string[], target: string): Promise<string[]> {
return dag
.docker(src)
.publish(dockerfile, address, tags, target)
}withBuildArg() 🔗
Add docker build args to builds
Return Type
Docker !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | name of the secret |
| value | String ! | - | value of the secret |
Example
dagger -m github.com/act3-ai/dagger/docker@0b0aaef3b89117273914795c82e2eb9ea87a2448 call \
--src DIR_PATH with-build-arg --name string --value stringfunc (m *MyModule) Example(src *dagger.Directory, name string, value string) *dagger.Docker {
return dag.
Docker(src).
WithBuildArg(name, value)
}@function
def example(src: dagger.Directory, name: str, value: str) -> dagger.Docker:
return (
dag.docker(src)
.with_build_arg(name, value)
)@func()
example(src: Directory, name: string, value: string): Docker {
return dag
.docker(src)
.withBuildArg(name, value)
}withDockerConfig() 🔗
Add docker registry creds to builds
Return Type
Docker !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| file | File ! | - | file path to docker config json |
Example
dagger -m github.com/act3-ai/dagger/docker@0b0aaef3b89117273914795c82e2eb9ea87a2448 call \
--src DIR_PATH with-docker-config --file file:pathfunc (m *MyModule) Example(src *dagger.Directory, file *dagger.File) *dagger.Docker {
return dag.
Docker(src).
WithDockerConfig(file)
}@function
def example(src: dagger.Directory, file: dagger.File) -> dagger.Docker:
return (
dag.docker(src)
.with_docker_config(file)
)@func()
example(src: Directory, file: File): Docker {
return dag
.docker(src)
.withDockerConfig(file)
}withLabel() 🔗
Add labels to builds
Return Type
Docker !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | name of the secret |
| value | String ! | - | value of the secret |
Example
dagger -m github.com/act3-ai/dagger/docker@0b0aaef3b89117273914795c82e2eb9ea87a2448 call \
--src DIR_PATH with-label --name string --value stringfunc (m *MyModule) Example(src *dagger.Directory, name string, value string) *dagger.Docker {
return dag.
Docker(src).
WithLabel(name, value)
}@function
def example(src: dagger.Directory, name: str, value: str) -> dagger.Docker:
return (
dag.docker(src)
.with_label(name, value)
)@func()
example(src: Directory, name: string, value: string): Docker {
return dag
.docker(src)
.withLabel(name, value)
}withRegistryCreds() 🔗
Add docker registry creds to builds
Return Type
Docker !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| registry | String ! | - | name of the registry |
| username | String ! | - | username for registry |
| password | Secret ! | - | password for registry |
Example
dagger -m github.com/act3-ai/dagger/docker@0b0aaef3b89117273914795c82e2eb9ea87a2448 call \
--src DIR_PATH with-registry-creds --registry string --username string --password env:MYSECRETfunc (m *MyModule) Example(src *dagger.Directory, registry string, username string, password *dagger.Secret) *dagger.Docker {
return dag.
Docker(src).
WithRegistryCreds(registry, username, password)
}@function
def example(src: dagger.Directory, registry: str, username: str, password: dagger.Secret) -> dagger.Docker:
return (
dag.docker(src)
.with_registry_creds(registry, username, password)
)@func()
example(src: Directory, registry: string, username: string, password: Secret): Docker {
return dag
.docker(src)
.withRegistryCreds(registry, username, password)
}withSecret() 🔗
Add a docker secret to builds
Return Type
Docker !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | name of the secret |
| value | Secret ! | - | value of the secret |
Example
dagger -m github.com/act3-ai/dagger/docker@0b0aaef3b89117273914795c82e2eb9ea87a2448 call \
--src DIR_PATH with-secret --name string --value env:MYSECRETfunc (m *MyModule) Example(src *dagger.Directory, name string, value *dagger.Secret) *dagger.Docker {
return dag.
Docker(src).
WithSecret(name, value)
}@function
def example(src: dagger.Directory, name: str, value: dagger.Secret) -> dagger.Docker:
return (
dag.docker(src)
.with_secret(name, value)
)@func()
example(src: Directory, name: string, value: Secret): Docker {
return dag
.docker(src)
.withSecret(name, value)
}