workspace
This module has been generated via dagger init and serves as a reference tobasic 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@d128343dc6623253dcff12f2b2689e0d8dbaea3d
Entrypoint
Return Type
Workspace !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
workdir | Directory ! | - | No description provided |
Example
dagger -m github.com/samalba/agents/dockerfile-optimizer/workspace@d128343dc6623253dcff12f2b2689e0d8dbaea3d call \
--workdir DIR_PATH
func (m *MyModule) Example(workdir *dagger.Directory) *dagger.Workspace {
return dag.
Workspace(workdir)
}
@function
def example(workdir: dagger.Directory) -> dagger.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@d128343dc6623253dcff12f2b2689e0d8dbaea3d call \
--workdir DIR_PATH workdir
func (m *MyModule) Example(workdir *dagger.Directory) *dagger.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
Name | Type | Default Value | Description |
---|---|---|---|
path | String ! | - | No description provided |
Example
dagger -m github.com/samalba/agents/dockerfile-optimizer/workspace@d128343dc6623253dcff12f2b2689e0d8dbaea3d call \
--workdir DIR_PATH read --path string
func (m *MyModule) Example(ctx context.Context, workdir *dagger.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
Name | Type | Default Value | Description |
---|---|---|---|
path | String ! | - | No description provided |
content | String ! | - | No description provided |
Example
dagger -m github.com/samalba/agents/dockerfile-optimizer/workspace@d128343dc6623253dcff12f2b2689e0d8dbaea3d call \
--workdir DIR_PATH write --path string --content string
func (m *MyModule) Example(workdir *dagger.Directory, path string, content string) *dagger.Workspace {
return dag.
Workspace(workdir).
Write(path, content)
}
@function
def example(workdir: dagger.Directory, path: str, content: str) -> dagger.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
Name | Type | Default Value | Description |
---|---|---|---|
path | String ! | - | No description provided |
Example
dagger -m github.com/samalba/agents/dockerfile-optimizer/workspace@d128343dc6623253dcff12f2b2689e0d8dbaea3d call \
--workdir DIR_PATH build --path string
func (m *MyModule) Example(ctx context.Context, workdir *dagger.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)
}