Dagger
Search

workspace

This module has been generated via dagger init and serves as a reference to
basic module structure as you get started with Dagger.

Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.

The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.

Installation

dagger install github.com/samalba/agents/dockerfile-optimizer/workspace@2bde48946e1b2c6308a81121d7d63a93984dfdf2

Entrypoint

Return Type
Workspace !
Arguments
NameTypeDefault ValueDescription
workdirDirectory !-No description provided
Example
dagger -m github.com/samalba/agents/dockerfile-optimizer/workspace@2bde48946e1b2c6308a81121d7d63a93984dfdf2 call \
 --workdir DIR_PATH
func (m *myModule) example(workdir *Directory) *Workspace  {
	return dag.
			Workspace(workdir)
}
@function
def example(workdir: dagger.Directory) -> dag.Workspace:
	return (
		dag.workspace(workdir)
	)
@func()
example(workdir: Directory): Workspace {
	return dag
		.workspace(workdir)
}

Types

Workspace 🔗

workdir() 🔗

The workspace’s directory state

Return Type
Directory !
Example
dagger -m github.com/samalba/agents/dockerfile-optimizer/workspace@2bde48946e1b2c6308a81121d7d63a93984dfdf2 call \
 --workdir DIR_PATH workdir
func (m *myModule) example(workdir *Directory) *Directory  {
	return dag.
			Workspace(workdir).
			Workdir()
}
@function
def example(workdir: dagger.Directory) -> dagger.Directory:
	return (
		dag.workspace(workdir)
		.workdir()
	)
@func()
example(workdir: Directory): Directory {
	return dag
		.workspace(workdir)
		.workdir()
}

read() 🔗

Read a file at the given path

Return Type
String !
Arguments
NameTypeDefault ValueDescription
pathString !-No description provided
Example
dagger -m github.com/samalba/agents/dockerfile-optimizer/workspace@2bde48946e1b2c6308a81121d7d63a93984dfdf2 call \
 --workdir DIR_PATH read --path string
func (m *myModule) example(ctx context.Context, workdir *Directory, path string) string  {
	return dag.
			Workspace(workdir).
			Read(ctx, path)
}
@function
async def example(workdir: dagger.Directory, path: str) -> str:
	return await (
		dag.workspace(workdir)
		.read(path)
	)
@func()
async example(workdir: Directory, path: string): Promise<string> {
	return dag
		.workspace(workdir)
		.read(path)
}

write() 🔗

Write a file at the given path with the given content

Return Type
Workspace !
Arguments
NameTypeDefault ValueDescription
pathString !-No description provided
contentString !-No description provided
Example
dagger -m github.com/samalba/agents/dockerfile-optimizer/workspace@2bde48946e1b2c6308a81121d7d63a93984dfdf2 call \
 --workdir DIR_PATH write --path string --content string
func (m *myModule) example(workdir *Directory, path string, content string) *Workspace  {
	return dag.
			Workspace(workdir).
			Write(path, content)
}
@function
def example(workdir: dagger.Directory, path: str, content: str) -> dag.Workspace:
	return (
		dag.workspace(workdir)
		.write(path, content)
	)
@func()
example(workdir: Directory, path: string, content: string): Workspace {
	return dag
		.workspace(workdir)
		.write(path, content)
}

build() 🔗

Build the container from the Dockerfile at the given path

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
pathString !-No description provided
Example
dagger -m github.com/samalba/agents/dockerfile-optimizer/workspace@2bde48946e1b2c6308a81121d7d63a93984dfdf2 call \
 --workdir DIR_PATH build --path string
func (m *myModule) example(ctx context.Context, workdir *Directory, path string)   {
	return dag.
			Workspace(workdir).
			Build(ctx, path)
}
@function
async def example(workdir: dagger.Directory, path: str) -> None:
	return await (
		dag.workspace(workdir)
		.build(path)
	)
@func()
async example(workdir: Directory, path: string): Promise<void> {
	return dag
		.workspace(workdir)
		.build(path)
}