Dagger
Search

depot

The Depot module can be used to route any container image build to our remote build service. You can use it to build container images on fast native Intel & Arm CPUs with persistent layer cache on NVMe disks. We have functions for both depot build and depot bake.

With build, we build your container image for the Dockerfile you specify and return you the built container to use in your pipeline. With bake, you can pass in your bake file and we will build all of the targets in your bake file concurrently.

For more examples of cool things you can do with Dagger + Depot, check out our README in our Daggerverse repo.

Installation

dagger install github.com/depot/daggerverse/depot@v1.1.0

Entrypoint

Return Type
Depot
Example
func (m *myModule) example() *Depot  {
	return dag.
			Depot()
}
@function
def example() -> dag.Depot:
	return (
		dag.depot()
	)
@func()
example(): Depot {
	return dag
		.depot()
}

Types

Depot

build()

Build builds a container image artifact from a Dockerfile using https://depot.dev.

Example usage: dagger call build --token env:DEPOT_TOKEN --project $DEPOT_PROJECT --directory . --lint container

Return Type
BuildArtifact !
Arguments
NameTypeDefault ValueDescription
depotVersionString -Depot CLI version
tokenSecret !-Depot token
projectString !-Depot project id
directoryDirectory !-Source context directory for build
dockerfileString "Dockerfile"Path to dockerfile
platforms[String ! ] nullPlatforms are architecture and OS combinations for which to build the image.
sbomBoolean falseProduce software bill of materials for image
noCacheBoolean falseD not use layer cache when building the image
noSaveBoolean falseDo not save the image to the depot ephemeral registry
lintBoolean falseLint dockerfile
buildArgs[String ! ] nullNo description provided
labels[String ! ] nullLabels to apply to the image
outputs[String ! ] nullOutputs override the default
provenanceString -No description provided
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 build --token env:MYSECRET --project string --directory DIR_PATH \
 container
func (m *myModule) example(token *Secret, project string, directory *Directory) *DepotBuildArtifact  {
	return dag.
			Depot().
			Build(token, project, directory)
}
@function
def example(token: dagger.Secret, project: str, directory: dagger.Directory) -> dag.DepotBuildArtifact:
	return (
		dag.depot()
		.build(token, project, directory)
	)
@func()
example(token: Secret, project: string, directory: Directory): DepotBuildArtifact {
	return dag
		.depot()
		.build(token, project, directory)
}

bake()

Bake builds many containers using https://depot.dev.

example usage: dagger call bake --token $DEPOT_TOKEN --project $DEPOT_PROJECT --directory . --bake-file docker-bake.hcl

Return Type
Artifacts !
Arguments
NameTypeDefault ValueDescription
depotVersionString -depot CLI version
tokenSecret !-depot token
projectString !-depot project id
directoryDirectory !-source context directory for build
bakeFileString !-path to bake definition file
sbomBoolean falseproduce software bill of materials for image
noCacheBoolean falsedo not use layer cache when building the image
noSaveBoolean falseDo not save the image to the depot ephemeral registry
lintBoolean falselint dockerfile
provenanceString -No description provided
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 container
func (m *myModule) example(token *Secret, project string, directory *Directory, bakeFile string) *DepotArtifacts  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile)
}
@function
def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str) -> dag.DepotArtifacts:
	return (
		dag.depot()
		.bake(token, project, directory, bake_file)
	)
@func()
example(token: Secret, project: string, directory: Directory, bakeFile: string): DepotArtifacts {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
}

BuildArtifact

token()

depot token

Return Type
Secret !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 token
func (m *myModule) example(token *Secret, project string, directory *Directory, bakeFile string, target string) *Secret  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target).
			Token()
}
@function
def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> dagger.Secret:
	return (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
		.token()
	)
@func()
example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): Secret {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
		.token()
}

project()

depot project id

Return Type
String !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 project
func (m *myModule) example(ctx context.Context, token *Secret, project string, directory *Directory, bakeFile string, target string) string  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target).
			Project(ctx)
}
@function
async def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> str:
	return await (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
		.project()
	)
@func()
async example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): Promise<string> {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
		.project()
}

target()

Return Type
String !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 target
func (m *myModule) example(ctx context.Context, token *Secret, project string, directory *Directory, bakeFile string, target string) string  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target).
			Target(ctx)
}
@function
async def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> str:
	return await (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
		.target()
	)
@func()
async example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): Promise<string> {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
		.target()
}

sbomdir()

Return Type
Directory !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 sbomdir
func (m *myModule) example(token *Secret, project string, directory *Directory, bakeFile string, target string) *Directory  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target).
			Sbomdir()
}
@function
def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> dagger.Directory:
	return (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
		.sbomdir()
	)
@func()
example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): Directory {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
		.sbomdir()
}

imageName()

Return Type
String !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 image-name
func (m *myModule) example(ctx context.Context, token *Secret, project string, directory *Directory, bakeFile string, target string) string  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target).
			ImageName(ctx)
}
@function
async def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> str:
	return await (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
		.image_name()
	)
@func()
async example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): Promise<string> {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
		.imageName()
}

size()

Return Type
Integer !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 size
func (m *myModule) example(ctx context.Context, token *Secret, project string, directory *Directory, bakeFile string, target string) int  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target).
			Size(ctx)
}
@function
async def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> int:
	return await (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
		.size()
	)
@func()
async example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): Promise<number> {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
		.size()
}

container()

Creates a container from the recently built image artifact.

Return Type
Container !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 container
func (m *myModule) example(token *Secret, project string, directory *Directory, bakeFile string, target string) *Container  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target).
			Container()
}
@function
def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> dagger.Container:
	return (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
		.container()
	)
@func()
example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): Container {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
		.container()
}

imageBytes()

Returns the size in bytes of the image.

Return Type
Integer !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 image-bytes
func (m *myModule) example(ctx context.Context, token *Secret, project string, directory *Directory, bakeFile string, target string) int  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target).
			ImageBytes(ctx)
}
@function
async def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> int:
	return await (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
		.image_bytes()
	)
@func()
async example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): Promise<number> {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
		.imageBytes()
}

sbom()

Returns an SBOM if built option --sbom was requested. Returns an error if the build did not produce SBOMs.

Return Type
File !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 sbom
func (m *myModule) example(token *Secret, project string, directory *Directory, bakeFile string, target string) *File  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target).
			Sbom()
}
@function
def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> dagger.File:
	return (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
		.sbom()
	)
@func()
example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): File {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
		.sbom()
}

Artifacts

artifacts()

Return Type
[BuildArtifact ! ] !
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 artifacts \
 container
func (m *myModule) example(token *Secret, project string, directory *Directory, bakeFile string) []*DepotBuildArtifact  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Artifacts()
}
@function
def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str) -> List[dag.DepotBuildArtifact]:
	return (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.artifacts()
	)
@func()
example(token: Secret, project: string, directory: Directory, bakeFile: string): DepotBuildArtifact[] {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.artifacts()
}

get()

Return Type
BuildArtifact !
Arguments
NameTypeDefault ValueDescription
targetString !-No description provided
Example
dagger -m github.com/depot/daggerverse/depot@ee9b0649ce582fb63c650c6834e6e779b3617a8a call \
 bake --token env:MYSECRET --project string --directory DIR_PATH --bake-file string \
 get --target string \
 container
func (m *myModule) example(token *Secret, project string, directory *Directory, bakeFile string, target string) *DepotBuildArtifact  {
	return dag.
			Depot().
			Bake(token, project, directory, bakeFile).
			Get(target)
}
@function
def example(token: dagger.Secret, project: str, directory: dagger.Directory, bake_file: str, target: str) -> dag.DepotBuildArtifact:
	return (
		dag.depot()
		.bake(token, project, directory, bake_file)
		.get(target)
	)
@func()
example(token: Secret, project: string, directory: Directory, bakeFile: string, target: string): DepotBuildArtifact {
	return dag
		.depot()
		.bake(token, project, directory, bakeFile)
		.get(target)
}