Dagger
Search

module-template-light

This module has been generated via dagger init and serves as a reference to
basic module structure as you get started with Dagger. The module demonstrates
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.
Example (OpenTerminal)
no available example in current language
// ModuleTemplateLight_OpenTerminal demonstrates how to open an interactive terminal session
// within a ModuleTemplateLight module container.
//
// This function showcases the initialization and configuration of a
// ModuleTemplateLight module container using various options like enabling Cgo,
// utilizing build cache, and including a GCC compiler.
//
// Parameters:
//   - None
//
// Returns:
//   - *dagger.Container: A configured Dagger container with an open terminal.
//
// Usage:
//
//	This function can be used to interactively debug or inspect the
//	container environment during test execution.
func (m *Go) ModuleTemplateLight_OpenTerminal() *dagger.Container {
	// Configure the ModuleTemplateLight module container with necessary options
	targetModule := dag.ModuleTemplateLight()

	// Retrieve and discard standard output
	_, _ = targetModule.Ctr().
		Stdout(context.Background())

	// Open and return the terminal session in the configured container
	return targetModule.Ctr().
		Terminal()
}
no available example in current language
no available example in current language
Example (PassedEnvVars)
no available example in current language
// ModuleTemplateLight_PassedEnvVars demonstrates how to pass environment variables to the ModuleTemplateLight module.
//
// This method configures a ModuleTemplateLight module to use specific environment variables from the host.
func (m *Go) ModuleTemplateLight_PassedEnvVars(ctx context.Context) error {
	targetModule := dag.ModuleTemplateLight(dagger.ModuleTemplateLightOpts{
		EnvVarsFromHost: []string{"SOMETHING=SOMETHING,SOMETHING=SOMETHING"},
	})

	out, err := targetModule.Ctr().
		WithExec([]string{"printenv"}).
		Stdout(ctx)

	if err != nil {
		return fmt.Errorf("failed when executing printenv: %w", err)
	}

	if out == "" {
		return errEnvVarsEmpty
	}

	if !strings.Contains(out, "SOMETHING") {
		return errEnvVarsDontMatch
	}

	return nil
}
no available example in current language
no available example in current language
Example (CreateContainer)
no available example in current language
// ModuleTemplateLight_CreateContainer initializes and returns a configured Dagger container.
//
// This method exemplifies the setup of a container within the ModuleTemplateLight module using the source directory.
//
// Parameters:
//   - ctx: The context for controlling the function's timeout and cancellation.
//
// Returns:
//   - A configured Dagger container if successful, or an error if the process fails.
//
// Steps Involved:
//  1. Configure the ModuleTemplateLight module with the source directory.
//  2. Run a command inside the container to check the OS information.
func (m *Go) ModuleTemplateLight_CreateContainer(ctx context.Context) (*dagger.Container, error) {
	targetModule := dag.
		ModuleTemplateLight().
		BaseAlpine().
		WithUtilitiesInAlpineContainer(). // Install utilities
		WithGitInAlpineContainer().       // Install git
		WithSource(m.TestDir)

	// Get the OS or container information
	_, err := targetModule.
		Ctr().WithExec([]string{"uname"}).
		Stdout(ctx)

	if err != nil {
		return nil, fmt.Errorf("failed to get OS information: %w", err)
	}

	return targetModule.Ctr(), nil
}
no available example in current language
no available example in current language
Example (RunArbitraryCommand)
no available example in current language
// ModuleTemplateLight_RunArbitraryCommand runs an arbitrary shell command in the test container.
//
// This function demonstrates how to execute a shell command within the container
// using the ModuleTemplateLight module.
//
// Parameters:
//
//	ctx - context for controlling the function lifetime.
//
// Returns:
//
//	A string containing the output of the executed command, or an error if the command fails or if the output is empty.
func (m *Go) ModuleTemplateLight_RunArbitraryCommand(ctx context.Context) (string, error) {
	targetModule := dag.ModuleTemplateLight().WithSource(m.TestDir)

	// Execute the 'ls -l' command
	out, err := targetModule.
		Ctr().
		WithExec([]string{"ls", "-l"}).
		Stdout(ctx)

	if err != nil {
		return "", fmt.Errorf("failed to run shell command: %w", err)
	}

	if out == "" {
		return "", errExpectedFoldersNotFound
	}

	return out, nil
}
no available example in current language
no available example in current language

Installation

dagger install github.com/Excoriate/daggerverse/module-template-light@v0.3.0

Entrypoint

Return Type
ModuleTemplateLight !
Arguments
NameTypeDescription
versionString version (image tag) to use for the container image.
imageString image is the imageURL (without the version) that's going to be used for his base container.
ctrContainer ctr is the container to use as a base container.
envVarsFromHost[String ! ] envVarsFromHost is a list of environment variables to pass from the host to the container in a slice of strings.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
}

Types

ModuleTemplateLight 🔗

ModuleTemplateLight is a Dagger module. This module is used to create and manage containers.

ctr() 🔗

Ctr is the container to use as a base container.

Return Type
Container !
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 ctr
func (m *myModule) example() *Container  {
	return dag.
			ModuleTemplateLight().
			Ctr()
}
@function
def example() -> dagger.Container:
	return (
		dag.module_template_light()
		.ctr()
	)
@func()
example(): Container {
	return dag
		.moduleTemplateLight()
		.ctr()
}

base() 🔗

Base sets the base image and version, and creates the base container.

The default image is “alpine/latest” and the default version is “latest”.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
imageUrlString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 base --image-url string
func (m *myModule) example(imageUrl string) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			Base(imageUrl)
}
@function
def example(image_url: str) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.base(image_url)
	)
@func()
example(imageUrl: string): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.base(imageUrl)
}

downloadFile() 🔗

DownloadFile downloads a file from the specified URL.

Parameters: - url: The URL of the file to download. - destFileName: The name of the file to download. Optional parameter. If not set, it’ll default to the basename of the URL.

Returns: - *dagger.File: The downloaded file.

Functionality:

This method downloads a file from the provided URL. If the destination file name is not specified, it defaults to the basename of the URL. The downloaded file is then returned as a *dagger.File.

Return Type
File !
Arguments
NameTypeDefault ValueDescription
urlString !-url is the URL of the file to download.
destFileNameString -destFileName is the name of the file to download. If not set, it'll default to the basename of the URL.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 download-file --url string
func (m *myModule) example(url string) *File  {
	return dag.
			ModuleTemplateLight().
			DownloadFile(url)
}
@function
def example(url: str) -> dagger.File:
	return (
		dag.module_template_light()
		.download_file(url)
	)
@func()
example(url: string): File {
	return dag
		.moduleTemplateLight()
		.downloadFile(url)
}

cloneGitRepo() 🔗

CloneGitRepo clones a Git repository into a Dagger Directory.

Parameters: - repoURL: The URL of the git repository to clone (e.g., “https://github.com/user/repo”). - token: (Optional) The VCS token to use for authentication. If not provided, the repository will be cloned without authentication. - vcs: (Optional) The version control system (VCS) to use for authentication. Defaults to “github”. Supported values are “github” and “gitlab”.

Returns: - *dagger.Directory: A directory object representing the cloned repository.

If a token is provided, it will be securely set using Dagger’s secret mechanism and used for authentication during the clone operation.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
repoUrlString !-repoURL is the URL of the git repo to clone.
tokenSecret -token is the VCS token to use for authentication. Optional parameter.
vcsString -vcs is the VCS to use for authentication. Optional parameter.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 clone-git-repo --repo-url string
func (m *myModule) example(repoUrl string) *Directory  {
	return dag.
			ModuleTemplateLight().
			CloneGitRepo(repoUrl)
}
@function
def example(repo_url: str) -> dagger.Directory:
	return (
		dag.module_template_light()
		.clone_git_repo(repo_url)
	)
@func()
example(repoUrl: string): Directory {
	return dag
		.moduleTemplateLight()
		.cloneGitRepo(repoUrl)
}

openTerminal() 🔗

OpenTerminal returns a terminal

It returns a terminal for the container. Arguments: - None. Returns: - *Terminal: The terminal for the container.

Return Type
Container !
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 open-terminal
func (m *myModule) example() *Container  {
	return dag.
			ModuleTemplateLight().
			OpenTerminal()
}
@function
def example() -> dagger.Container:
	return (
		dag.module_template_light()
		.open_terminal()
	)
@func()
example(): Container {
	return dag
		.moduleTemplateLight()
		.openTerminal()
}

runShell() 🔗

RunShell runs a shell command in the container.

It runs a shell command in the container and returns the output. Arguments: - cmd: The command to run in the container. Returns: - string: The output of the command. - error: An error if the command fails.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
cmdString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 run-shell --cmd string
func (m *myModule) example(ctx context.Context, cmd string) string  {
	return dag.
			ModuleTemplateLight().
			RunShell(ctx, cmd)
}
@function
async def example(cmd: str) -> str:
	return await (
		dag.module_template_light()
		.run_shell(cmd)
	)
@func()
async example(cmd: string): Promise<string> {
	return dag
		.moduleTemplateLight()
		.runShell(cmd)
}

withGoPlatform() 🔗

WithGoPlatform sets the Go environment variables for the target platform.

platform is the target platform specified in the format “[os]/[platform]/[version]”. For example, “darwin/arm64/v7”, “windows/amd64”, “linux/arm64”. If the platform is not provided, it defaults to “linux/amd64”.

Params: - platform (dagger.Platform): The target platform.

Returns: - *ModuleTemplateLight: A pointer to the updated ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
platformScalar -platform is the target platform specified in the format "[os]/[platform]/[version]". For example, "darwin/arm64/v7", "windows/amd64", "linux/arm64". If the platform is not provided, it defaults to "linux/amd64".
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-go-platform
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithGoPlatform()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_go_platform()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withGoPlatform()
}

withGoCgoEnabled() 🔗

WithGoCgoEnabled enables CGO for the container environment.

When CGO is enabled, the Go toolchain will allow the use of cgo, which means it can link against C libraries and send code to the C compiler.

Returns: - *ModuleTemplateLight: A pointer to the updated ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-go-cgo-enabled
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithGoCgoEnabled()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_go_cgo_enabled()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withGoCgoEnabled()
}

withCgoDisabled() 🔗

WithCgoDisabled disables CGO for the container environment.

When CGO is disabled, the Go toolchain will not permit the use of cgo, which means it will not link against C libraries or send code to the C compiler. This can be beneficial for creating fully static binaries or for environments where C dependencies are not available.

Returns: - *ModuleTemplateLight: A pointer to the updated ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-cgo-disabled
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithCgoDisabled()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_cgo_disabled()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withCgoDisabled()
}

withGoBuildCache() 🔗

WithGoBuildCache configures a Go build cache for the container environment.

This method sets up the cache volume for Go build artifacts, which speeds up the build process by reusing previously compiled packages and dependencies.

Params: - cacheRoot (string) +optional: The path to the cache volume’s root. If not provided, it defaults to “/root/.cache/go-build”. - cache (*dagger.CacheVolume) +optional: The cache volume to use. If not provided, a default volume named “gobuildcache” is used. - source (*dagger.Directory) +optional: The directory to use as the source for the cache volume’s root. - sharing (dagger.CacheSharingMode) +optional: The sharing mode of the cache volume. If not provided, it defaults to “shared”.

Returns: - *ModuleTemplateLight: A pointer to the updated ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
cacheRootString -cacheRoot is the path to the cache volume's root.
cacheCacheVolume -cache is the cache volume to use.
sourceDirectory -source is the identifier of the directory to use as the cache volume's root.
sharingEnum -sharing is the Sharing mode of the cache volume.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-go-build-cache
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithGoBuildCache()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_go_build_cache()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withGoBuildCache()
}

withGoModCache() 🔗

WithGoModCache configures a Go module cache for the container environment.

This method sets up the cache volume for Go modules, which speeds up the build process by reusing previously downloaded dependencies.

Params: - cacheRoot (string): The path to the cache volume’s root. If not provided, it defaults to “/go/pkg/mod”. - cache (*dagger.CacheVolume) +optional: The cache volume to use. If not provided, a default volume named “gomodcache” is used. - source (*dagger.Directory) +optional: The directory to use as the source for the cache volume’s root. - sharing (dagger.CacheSharingMode) +optional: The sharing mode of the cache volume. If not provided, it defaults to “shared”.

Returns: - *ModuleTemplateLight: A pointer to the updated ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
cacheRootString -cacheRoot is the path to the cache volume's root.
cacheCacheVolume -cache is the cache volume to use.
sourceDirectory -source is the identifier of the directory to use as the cache volume's root.
sharingEnum -sharing is the Sharing mode of the cache volume.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-go-mod-cache
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithGoModCache()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_go_mod_cache()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withGoModCache()
}

withGoInstall() 🔗

WithGoInstall installs Go packages in the container environment.

This method uses the Go toolchain to install packages from specified URLs. It performs the equivalent of running “go install [url]” inside the container.

Params: - pkgs ([]string): A slice of URLs for the Go packages to install. These should be valid package URLs that the go install command can use.

Example:

ModuleTemplateLight.WithGoInstall([]string{"github.com/Excoriate/daggerverse@latest",

“github.com/another/package@v1.0”})

Returns: - *ModuleTemplateLight: A pointer to the updated ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
pkgs[String ! ] !-pkgs are the URLs of the packages to install.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-go-install --pkgs string1 --pkgs string2
func (m *myModule) example(pkgs []string) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithGoInstall(pkgs)
}
@function
def example(pkgs: List[str]) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_go_install(pkgs)
	)
@func()
example(pkgs: string[]): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withGoInstall(pkgs)
}

withGoExec() 🔗

WithGoExec runs a Go command in the container environment.

This method allows you to execute arbitrary Go commands, such as “go build” or “go test”, for a specified platform. If no platform is provided, it defaults to “linux/amd64”.

Params: - args ([]string): The arguments to pass to the Go command. For example, [“build”, “./…”] to run a Go build command on all packages. - platform (dagger.Platform) +optional: The target platform specified in the format “[os]/[platform]/[version]”. For example, “darwin/arm64/v7”, “windows/amd64”, “linux/arm64”. If the platform is not provided, it defaults to “linux/amd64”.

Example:

ModuleTemplateLight.WithGoExec([]string{"build", "./..."}, "linux/amd64")

Returns: - *ModuleTemplateLight: A pointer to the updated ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
args[String ! ] !-args are the arguments to pass to the Go command.
platformScalar -platform is the target platform specified in the format "[os]/[platform]/[version]". For example, "darwin/arm64/v7", "windows/amd64", "linux/arm64". If the platform is not provided, it defaults to "linux/amd64".
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-go-exec --args string1 --args string2
func (m *myModule) example(args []string) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithGoExec(args)
}
@function
def example(args: List[str]) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_go_exec(args)
	)
@func()
example(args: string[]): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withGoExec(args)
}

withGitInAlpineContainer() 🔗

WithGitInAlpineContainer installs Git in the golang/alpine container.

It installs Git in the golang/alpine container.

Return Type
ModuleTemplateLight !
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-git-in-alpine-container
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithGitInAlpineContainer()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_git_in_alpine_container()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withGitInAlpineContainer()
}

withGitInUbuntuContainer() 🔗

WithGitInUbuntuContainer installs Git in the Ubuntu-based container.

This method installs Git in the Ubuntu-based container.

Returns: - *ModuleTemplateLight: The updated ModuleTemplateLight with Git installed in the container.

Return Type
ModuleTemplateLight !
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-git-in-ubuntu-container
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithGitInUbuntuContainer()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_git_in_ubuntu_container()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withGitInUbuntuContainer()
}

withUtilitiesInAlpineContainer() 🔗

WithUtilitiesInAlpineContainer installs common utilities in the golang/alpine container.

It installs utilities such as curl, wget, and others that are commonly used.

Return Type
ModuleTemplateLight !
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-utilities-in-alpine-container
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithUtilitiesInAlpineContainer()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_utilities_in_alpine_container()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withUtilitiesInAlpineContainer()
}

withUtilitiesInUbuntuContainer() 🔗

WithUtilitiesInUbuntuContainer installs common utilities in the Ubuntu-based container.

This method updates the package lists for upgrades and installs the specified utilities such as curl, wget, bash, jq, and vim in the Ubuntu-based container.

Returns: - *ModuleTemplateLight: The updated ModuleTemplateLight with the utilities installed in the container.

Return Type
ModuleTemplateLight !
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-utilities-in-ubuntu-container
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithUtilitiesInUbuntuContainer()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_utilities_in_ubuntu_container()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withUtilitiesInUbuntuContainer()
}

withEnvironmentVariable() 🔗

WithEnvironmentVariable sets an environment variable in the container.

Parameters: - name: The name of the environment variable (e.g., “HOST”). - value: The value of the environment variable (e.g., “localhost”). - expand: Whether to replace ${VAR} or \(VAR in the value according to the current environment variables defined in the container (e.g., "/opt/bin:\)PATH”). Optional parameter.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
nameString !-name is the name of the environment variable.
valueString !-value is the value of the environment variable.
expandBoolean -expand is whether to replace `${VAR}` or $VAR in the value according to the current
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-environment-variable --name string --value string
func (m *myModule) example(name string, value string) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithEnvironmentVariable(name, value)
}
@function
def example(name: str, value: str) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_environment_variable(name, value)
	)
@func()
example(name: string, value: string): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withEnvironmentVariable(name, value)
}

withSource() 🔗

WithSource sets the source directory for the container.

Parameters: - src: The directory that contains all the source code, including the module directory. - workdir: The working directory within the container. Optional parameter.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-src is the directory that contains all the source code, including the module directory.
workdirString -workdir is the working directory within the container. If not set it'll default to /mnt
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-source --src DIR_PATH
func (m *myModule) example(src *Directory) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithSource(src)
}
@function
def example(src: dagger.Directory) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_source(src)
	)
@func()
example(src: Directory): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withSource(src)
}

withContainer() 🔗

WithContainer sets the container to be used.

Parameters: - ctr: The container to run the command in. If passed, it will override the container set in the Dagger instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-container --ctr IMAGE:TAG
func (m *myModule) example(ctr *Container) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithContainer(ctr)
}
@function
def example(ctr: dagger.Container) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_container(ctr)
	)
@func()
example(ctr: Container): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withContainer(ctr)
}

withFileMountedInContainer() 🔗

WithFileMountedInContainer adds a file to the container.

Parameters: - file: The file to add to the container. - dest: The destination path in the container. Optional parameter. - owner: The owner of the file. Optional parameter.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
fileFile !-No description provided
destString !-No description provided
ownerString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-file-mounted-in-container --file file:path --dest string --owner string
func (m *myModule) example(file *File, dest string, owner string) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithFileMountedInContainer(file, dest, owner)
}
@function
def example(file: dagger.File, dest: str, owner: str) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_file_mounted_in_container(file, dest, owner)
	)
@func()
example(file: File, dest: string, owner: string): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withFileMountedInContainer(file, dest, owner)
}

withSecretAsEnvVar() 🔗

WithSecretAsEnvVar sets an environment variable in the container using a secret.

Parameters: - name: The name of the environment variable (e.g., “API_KEY”). - secret: The secret containing the value of the environment variable.

Returns: - *ModuleTemplateLight: The updated ModuleTemplateLight with the environment variable set.

Behavior: - The secret value is expanded according to the current environment variables defined in the container.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
nameString !-No description provided
secretSecret !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-secret-as-env-var --name string --secret env:MYSECRET
func (m *myModule) example(name string, secret *Secret) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithSecretAsEnvVar(name, secret)
}
@function
def example(name: str, secret: dagger.Secret) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_secret_as_env_var(name, secret)
	)
@func()
example(name: string, secret: Secret): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withSecretAsEnvVar(name, secret)
}

withDownloadedFile() 🔗

WithDownloadedFile downloads a file from the specified URL and mounts it in the container.

Parameters: - url: The URL of the file to download. - destDir: The directory within the container where the file will be downloaded. Optional parameter. If not provided, it defaults to the predefined mount prefix.

Returns: - *ModuleTemplateLight: The updated ModuleTemplateLight with the downloaded file mounted in the container.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
urlString !-url is the URL of the file to download.
destFileNameString -destFileName is the name of the file to download. If not set, it'll default to the basename of the URL.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-downloaded-file --url string
func (m *myModule) example(url string) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithDownloadedFile(url)
}
@function
def example(url: str) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_downloaded_file(url)
	)
@func()
example(url: string): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withDownloadedFile(url)
}

withClonedGitRepo() 🔗

WithClonedGitRepo clones a Git repository and mounts it as a directory in the container.

This method downloads a Git repository and mounts it as a directory in the container. It supports optional authentication tokens for private repositories and can handle both GitHub and GitLab repositories.

Parameters: - repoURL: The URL of the git repository to clone (e.g., “https://github.com/user/repo”). - token: (Optional) The VCS token to use for authentication. If not provided, the repository will be cloned without authentication. - vcs: (Optional) The version control system (VCS) to use for authentication. Defaults to “github”. Supported values are “github” and “gitlab”.

Returns: - *ModuleTemplateLight: The updated ModuleTemplateLight with the cloned repository mounted in the container.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
repoUrlString !-No description provided
tokenSecret -token is the VCS token to use for authentication. Optional parameter.
vcsString -vcs is the VCS to use for authentication. Optional parameter.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-cloned-git-repo --repo-url string
func (m *myModule) example(repoUrl string) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithClonedGitRepo(repoUrl)
}
@function
def example(repo_url: str) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_cloned_git_repo(repo_url)
	)
@func()
example(repoUrl: string): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withClonedGitRepo(repoUrl)
}

withCacheBuster() 🔗

WithCacheBuster sets a cache-busting environment variable in the container.

This method sets an environment variable “CACHE_BUSTER” with a timestamp value in RFC3339Nano format. This can be useful for invalidating caches by providing a unique value.

Returns: - *ModuleTemplateLight: The updated ModuleTemplateLight with the cache-busting environment variable set.

Return Type
ModuleTemplateLight !
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-cache-buster
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithCacheBuster()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_cache_buster()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withCacheBuster()
}

withConfigFile() 🔗

WithConfigFile mounts a configuration file into the container at the specified path.

This method allows you to mount a configuration file into the container at a specified path. If no path is provided, it defaults to a predefined mount prefix from the fixtures package.

Args: - cfgPath (string): The path where the config file will be mounted. If empty, it defaults to fixtures.MntPrefix. +optional - cfgFile (*dagger.File): The config file to be mounted.

Returns: - *ModuleTemplateLight: The updated ModuleTemplateLight with the config file mounted in the container.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
cfgPathString -cfgPath is the path where the config file will be mounted.
setEnvVarString -setEnvVar is a string that set an environment variable in the container with the config file path.
cfgFileFile !-cfgFile is the config file to be mounted.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 with-config-file --cfg-file file:path
func (m *myModule) example(cfgFile *File) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			WithConfigFile(cfgFile)
}
@function
def example(cfg_file: dagger.File) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.with_config_file(cfg_file)
	)
@func()
example(cfgFile: File): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.withConfigFile(cfgFile)
}

baseAlpine() 🔗

BaseAlpine sets the base image to an Alpine Linux image and creates the base container.

Parameters: - version: The version of the Alpine image to use. Optional parameter. Defaults to “latest”.

Returns a pointer to the ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of the Alpine image to use, e.g., "3.17.3".
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 base-alpine
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			BaseAlpine()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.base_alpine()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.baseAlpine()
}

baseUbuntu() 🔗

BaseUbuntu sets the base image to an Ubuntu Linux image and creates the base container.

Parameters: - version: The version of the Ubuntu image to use. Optional parameter. Defaults to “latest”.

Returns a pointer to the ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of the Ubuntu image to use, e.g., "22.04".
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 base-ubuntu
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			BaseUbuntu()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.base_ubuntu()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.baseUbuntu()
}

baseBusyBox() 🔗

BaseBusyBox sets the base image to a BusyBox Linux image and creates the base container.

Parameters: - version: The version of the BusyBox image to use. Optional parameter. Defaults to “latest”.

Returns a pointer to the ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of the BusyBox image to use, e.g., "1.35.0".
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 base-busy-box
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			BaseBusyBox()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.base_busy_box()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.baseBusyBox()
}

baseWolfi() 🔗

BaseWolfi sets the base image to a Wolfi Linux image and creates the base container.

Parameters: - version: The version of the Wolfi image to use. Optional parameter. Defaults to “latest”. - packages: Additional packages to install. Optional parameter. - overlays: Overlay images to merge on top of the base. Optional parameter.

Returns a pointer to the ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of the Wolfi image to use, e.g., "latest".
packages[String ! ] -packages is the list of additional packages to install.
overlays[Container ! ] -overlays are images to merge on top of the base. See https://twitter.com/ibuildthecloud/status/1721306361999597884
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 base-wolfi
func (m *myModule) example() *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			BaseWolfi()
}
@function
def example() -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.base_wolfi()
	)
@func()
example(): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.baseWolfi()
}

baseApko() 🔗

BaseApko sets the base image to an Apko image and creates the base container.

Parameters: - presetFilePath: The path to the preset file. Either presetFile or presetFilePath must be provided. - presetFile: The preset file to use for the Apko image. Either presetFile or presetFilePath must be provided. - cacheDir: The cache directory to use for the Apko image. Optional parameter. - keyrings: The list of keyrings to use for the Apko image. They should be provided as path=url. - buildArch: Specifies the architecture to build for. Optional parameter. - buildContext: The build context directory. Optional parameter. - debug: Enables debug mode for verbose output. Optional parameter. - noNetwork: Disables network access during the build. Optional parameter. - repositoryAppend: A slice of additional repositories to append. Optional parameter. - timestamp: Sets a specific timestamp for reproducible builds. Optional parameter. - tags: A slice of additional tags for the output image. Optional parameter. - buildDate: Sets the build date for the APKO build. Optional parameter. - lockfile: Sets the lockfile path for the APKO build. Optional parameter. - offline: Enables offline mode for the APKO build. Optional parameter. - packageAppend: Adds extra packages to the APKO build. Optional parameter. - sbom: Enables or disables SBOM generation. Optional parameter. - sbomFormats: Sets the SBOM formats for the APKO build. Optional parameter.

Returns a pointer to the ModuleTemplateLight instance.

Return Type
ModuleTemplateLight !
Arguments
NameTypeDefault ValueDescription
presetFilePathString !-presetFilePath is the path to the preset file. Either presetFile or presetFilePath must be provided.
presetFileFile !-presetFile is the preset file to use for the Apko image. Either presetFile or presetFilePath must be provided.
cacheDirString -cacheDir is the cache directory to use for the Apko image.
keyrings[String ! ] -keyrings is the list of keyrings to use for the Apko image. They should be provided as path=url. E.g.: /etc/apk/keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub= https://alpinelinux.org/keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub
buildArchString -buildArch specifies the architecture to build for.
buildContextString -buildContext is the build context directory.
debugBoolean -debug enables debug mode for verbose output.
noNetworkBoolean -noNetwork disables network access during the build.
repositoryAppend[String ! ] -repositoryAppend is a slice of additional repositories to append.
timestampString -timestamp sets a specific timestamp for reproducible builds.
tags[String ! ] -tags is a slice of additional tags for the output image.
buildDateString -buildDate sets the build date for the APKO build.
lockfileString -lockfile sets the lockfile path for the APKO build.
offlineBoolean -offline enables offline mode for the APKO build.
packageAppend[String ! ] -packageAppend adds extra packages to the APKO build.
sbomBoolean -sbom enables or disables SBOM generation.
sbomFormats[String ! ] -sbomFormats sets the SBOM formats for the APKO build.
sbomPathString -sbomPath sets the SBOM output path for the APKO build.
vcsBoolean -vcs enables or disables VCS detection.
logLevelString -logLevel sets the log level for the APKO build.
logPolicy[String ! ] -logPolicy sets the log policy for the APKO build.
workdirString -workdir sets the working directory for the APKO build.
Example
dagger -m github.com/Excoriate/daggerverse/module-template-light@c07df99259f1116858636b059074af6490c2204b call \
 base-apko --preset-file-path string --preset-file file:path
func (m *myModule) example(presetFilePath string, presetFile *File) *ModuleTemplateLight  {
	return dag.
			ModuleTemplateLight().
			BaseApko(presetFilePath, presetFile)
}
@function
def example(preset_file_path: str, preset_file: dagger.File) -> dag.ModuleTemplateLight:
	return (
		dag.module_template_light()
		.base_apko(preset_file_path, preset_file)
	)
@func()
example(presetFilePath: string, presetFile: File): ModuleTemplateLight {
	return dag
		.moduleTemplateLight()
		.baseApko(presetFilePath, presetFile)
}