Dagger
Search

module-template

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
// ModuleTemplate_OpenTerminal demonstrates how to open an interactive terminal session
// within a ModuleTemplate module container.
//
// This function showcases the initialization and configuration of a
// ModuleTemplate 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) ModuleTemplate_OpenTerminal() *dagger.Container {
	// Configure the ModuleTemplate module container with necessary options
	targetModule := dag.ModuleTemplate()

	// 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
// ModuleTemplate_PassedEnvVars demonstrates how to pass environment variables to the ModuleTemplate module.
//
// This method configures a ModuleTemplate module to use specific environment variables from the host.
func (m *Go) ModuleTemplate_PassedEnvVars(ctx context.Context) error {
	targetModule := dag.ModuleTemplate(dagger.ModuleTemplateOpts{
		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
// ModuleTemplate_CreateContainer initializes and returns a configured Dagger container.
//
// This method exemplifies the setup of a container within the ModuleTemplate 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 ModuleTemplate module with the source directory.
//  2. Run a command inside the container to check the OS information.
func (m *Go) ModuleTemplate_CreateContainer(ctx context.Context) (*dagger.Container, error) {
	targetModule := dag.
		ModuleTemplate().
		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
// ModuleTemplate_RunArbitraryCommand runs an arbitrary shell command in the test container.
//
// This function demonstrates how to execute a shell command within the container
// using the ModuleTemplate 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) ModuleTemplate_RunArbitraryCommand(ctx context.Context) (string, error) {
	targetModule := dag.ModuleTemplate().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
Example (CreateNetRcFileForGithub)
no available example in current language
// ModuleTemplate_CreateNetRcFileForGithub creates and configures a .netrc file for GitHub authentication.
//
// This method exemplifies the creation of a .netrc file with credentials for accessing GitHub,
// and demonstrates how to pass this file as a secret to the ModuleTemplate module.
//
// Parameters:
//   - ctx: The context for controlling the function's timeout and cancellation.
//
// Returns:
//   - A configured Container with the .netrc file set as a secret, or an error if the process fails.
//
// Steps Involved:
//  1. Define GitHub password as a secret.
//  2. Configure the ModuleTemplate module to use the .netrc file with the provided credentials.
//  3. Run a command inside the container to verify the .netrc file's contents.
func (m *Go) ModuleTemplate_CreateNetRcFileForGithub(ctx context.Context) (*dagger.Container, error) {
	passwordAsSecret := dag.SetSecret("mysecret", "ohboywhatapassword")

	// Configure it for GitHub
	targetModule := dag.ModuleTemplate().
		WithNewNetrcFileAsSecretGitHub("supersecretuser", passwordAsSecret)

	// Check if the .netrc file is created correctly
	out, err := targetModule.
		Ctr().
		WithExec([]string{"cat", "/root/.netrc"}).
		Stdout(ctx)

	if err != nil {
		return nil, fmt.Errorf("failed to get netrc file configured for github: %w", err)
	}

	expectedContent := "machine github.com\nlogin supersecretuser\npassword ohboywhatapassword"
	if !strings.Contains(out, expectedContent) {
		return nil, errNetRCFileNotFound
	}

	return targetModule.Ctr(), nil
}
no available example in current language
no available example in current language

Installation

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

Entrypoint

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
}

Types

ModuleTemplate 🔗

ModuleTemplate 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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 ctr
func (m *myModule) example() *Container  {
	return dag.
			ModuleTemplate().
			Ctr()
}
@function
def example() -> dagger.Container:
	return (
		dag.module_template()
		.ctr()
	)
@func()
example(): Container {
	return dag
		.moduleTemplate()
		.ctr()
}

withNewNetrcFileGitHub() 🔗

WithNewNetrcFileGitHub creates a new .netrc file with the GitHub credentials.

The .netrc file is created in the root directory of the container.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
usernameString !-No description provided
passwordString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-new-netrc-file-git-hub --username string --password string
func (m *myModule) example(username string, password string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithNewNetrcFileGitHub(username, password)
}
@function
def example(username: str, password: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_new_netrc_file_git_hub(username, password)
	)
@func()
example(username: string, password: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withNewNetrcFileGitHub(username, password)
}

withNewNetrcFileAsSecretGitHub() 🔗

WithNewNetrcFileAsSecretGitHub creates a new .netrc file with the GitHub credentials.

The .netrc file is created in the root directory of the container. The argument ‘password’ is a secret that is not exposed in the logs.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
usernameString !-No description provided
passwordSecret !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-new-netrc-file-as-secret-git-hub --username string --password env:MYSECRET
func (m *myModule) example(username string, password *Secret) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithNewNetrcFileAsSecretGitHub(username, password)
}
@function
def example(username: str, password: dagger.Secret) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_new_netrc_file_as_secret_git_hub(username, password)
	)
@func()
example(username: string, password: Secret): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withNewNetrcFileAsSecretGitHub(username, password)
}

withNewNetrcFileGitLab() 🔗

WithNewNetrcFileGitLab creates a new .netrc file with the GitLab credentials.

The .netrc file is created in the root directory of the container.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
usernameString !-No description provided
passwordString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-new-netrc-file-git-lab --username string --password string
func (m *myModule) example(username string, password string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithNewNetrcFileGitLab(username, password)
}
@function
def example(username: str, password: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_new_netrc_file_git_lab(username, password)
	)
@func()
example(username: string, password: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withNewNetrcFileGitLab(username, password)
}

withNewNetrcFileAsSecretGitLab() 🔗

WithNewNetrcFileAsSecretGitLab creates a new .netrc file with the GitLab credentials.

The .netrc file is created in the root directory of the container. The argument ‘password’ is a secret that is not exposed in the logs.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
usernameString !-No description provided
passwordSecret !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-new-netrc-file-as-secret-git-lab --username string --password env:MYSECRET
func (m *myModule) example(username string, password *Secret) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithNewNetrcFileAsSecretGitLab(username, password)
}
@function
def example(username: str, password: dagger.Secret) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_new_netrc_file_as_secret_git_lab(username, password)
	)
@func()
example(username: string, password: Secret): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withNewNetrcFileAsSecretGitLab(username, password)
}

withDaggerClialpine() 🔗

WithDaggerCLIAlpine sets up the Dagger CLI entry point for Alpine within the ModuleTemplate.

Parameters: - version: The version of the Dagger Engine to use, e.g., “v0.12.7”.

This method performs the following steps: 1. Generates a shell command to install the Dagger CLI using the specified version. 2. Executes the installation command within the Alpine container context. 3. Sets the DAGGER_VERSION environment variable in the container.

Returns: - *ModuleTemplate: Returns the modified ModuleTemplate instance with the Dagger CLI configured.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
versionString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-dagger-clialpine --version string
func (m *myModule) example(version string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithDaggerClialpine(version)
}
@function
def example(version: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_dagger_clialpine(version)
	)
@func()
example(version: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withDaggerClialpine(version)
}

withDaggerCliubuntu() 🔗

WithDaggerCLIUbuntu sets up the Dagger CLI entry point for Ubuntu within the ModuleTemplate.

Parameters: - version: The version of the Dagger Engine to use, e.g., “v0.12.7”.

This method performs the following steps: 1. Updates package lists and installs curl. 2. Generates a shell command to install the Dagger CLI using the specified version. 3. Executes the installation command within the Ubuntu container context. 4. Sets the DAGGER_VERSION environment variable in the container.

Returns: - *ModuleTemplate: Returns the modified ModuleTemplate instance with the Dagger CLI configured.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
versionString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-dagger-cliubuntu --version string
func (m *myModule) example(version string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithDaggerCliubuntu(version)
}
@function
def example(version: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_dagger_cliubuntu(version)
	)
@func()
example(version: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withDaggerCliubuntu(version)
}

withDaggerDockerService() 🔗

WithDaggerDockerService sets up the container with the Docker service.

Arguments: - version: The version of the Docker engine to use, e.g., “v20.10.17”. If empty, a default version will be used.

Returns: - *dagger.Service: A Dagger service configured with Docker.

Return Type
Service !
Arguments
NameTypeDefault ValueDescription
versionString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-dagger-docker-service --version string
func (m *myModule) example(version string) *Service  {
	return dag.
			ModuleTemplate().
			WithDaggerDockerService(version)
}
@function
def example(version: str) -> dagger.Service:
	return (
		dag.module_template()
		.with_dagger_docker_service(version)
	)
@func()
example(version: string): Service {
	return dag
		.moduleTemplate()
		.withDaggerDockerService(version)
}

setupDaggerInDagger() 🔗

SetupDaggerInDagger sets up the Dagger CLI inside a Docker-in-Docker context.

This method validates the specified Dagger Engine version, installs the Dagger CLI in an Alpine-based container, replaces the existing container with a Docker-in-Docker container, and sets up the Docker service within the Dagger context.

Parameters: - dagVersion: The version of the Dagger Engine to use, e.g., “v0.12.7”. - dockerVersion: The version of the Docker Engine to use, e.g., “24.0”. This is optional.

Returns: - *ModuleTemplate: The modified ModuleTemplate instance with Dagger and Docker configured. - error: An error if the setup process fails at any step.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
dagVersionString !-The version of the Dagger Engine to use.
dockerVersionString -The version of the Docker Engine to use.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 setup-dagger-in-dagger --dag-version string
func (m *myModule) example(dagVersion string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			SetupDaggerInDagger(dagVersion)
}
@function
def example(dag_version: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.setup_dagger_in_dagger(dag_version)
	)
@func()
example(dagVersion: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.setupDaggerInDagger(dagVersion)
}

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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 open-terminal
func (m *myModule) example() *Container  {
	return dag.
			ModuleTemplate().
			OpenTerminal()
}
@function
def example() -> dagger.Container:
	return (
		dag.module_template()
		.open_terminal()
	)
@func()
example(): Container {
	return dag
		.moduleTemplate()
		.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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 run-shell --cmd string
func (m *myModule) example(ctx context.Context, cmd string) string  {
	return dag.
			ModuleTemplate().
			RunShell(ctx, cmd)
}
@function
async def example(cmd: str) -> str:
	return await (
		dag.module_template()
		.run_shell(cmd)
	)
@func()
async example(cmd: string): Promise<string> {
	return dag
		.moduleTemplate()
		.runShell(cmd)
}

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 ModuleTemplate instance.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 base-alpine
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			BaseAlpine()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.base_alpine()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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 ModuleTemplate instance.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 base-ubuntu
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			BaseUbuntu()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.base_ubuntu()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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 ModuleTemplate instance.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 base-busy-box
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			BaseBusyBox()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.base_busy_box()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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 ModuleTemplate instance.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 base-wolfi
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			BaseWolfi()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.base_wolfi()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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 ModuleTemplate instance.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 base-apko --preset-file-path string --preset-file file:path
func (m *myModule) example(presetFilePath string, presetFile *File) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			BaseApko(presetFilePath, presetFile)
}
@function
def example(preset_file_path: str, preset_file: dagger.File) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.base_apko(preset_file_path, preset_file)
	)
@func()
example(presetFilePath: string, presetFile: File): ModuleTemplate {
	return dag
		.moduleTemplate()
		.baseApko(presetFilePath, presetFile)
}

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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 download-file --url string
func (m *myModule) example(url string) *File  {
	return dag.
			ModuleTemplate().
			DownloadFile(url)
}
@function
def example(url: str) -> dagger.File:
	return (
		dag.module_template()
		.download_file(url)
	)
@func()
example(url: string): File {
	return dag
		.moduleTemplate()
		.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.
tokenString -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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 clone-git-repo --repo-url string
func (m *myModule) example(repoUrl string) *Directory  {
	return dag.
			ModuleTemplate().
			CloneGitRepo(repoUrl)
}
@function
def example(repo_url: str) -> dagger.Directory:
	return (
		dag.module_template()
		.clone_git_repo(repo_url)
	)
@func()
example(repoUrl: string): Directory {
	return dag
		.moduleTemplate()
		.cloneGitRepo(repoUrl)
}

withAwscliinAlpineContainer() 🔗

WithAWSCLIInAlpineContainer installs the AWS CLI in the Alpine-based container. This method installs the AWS CLI in a golang/alpine container using the ‘apk’ package manager. It is particularly useful for environments that need to interact with AWS services.

Returns: - *ModuleTemplate: The updated ModuleTemplate with the AWS CLI installed in the container.

Return Type
ModuleTemplate !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-awscliin-alpine-container
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithAwscliinAlpineContainer()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_awscliin_alpine_container()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withAwscliinAlpineContainer()
}

withAwscliinUbuntuContainer() 🔗

WithAWSCLIInUbuntuContainer installs the AWS CLI in the Ubuntu-based container.

This method installs the AWS CLI in an Ubuntu-based container following the official AWS installation steps.

Args: - architecture (string): The architecture for which the AWS CLI should be downloaded. Valid values are “x86_64” and “aarch64”. Default is “x86_64”.

Returns: - *ModuleTemplate: The updated ModuleTemplate with the AWS CLI installed in the container.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
architectureString -architecture is the architecture for which the AWS CLI should be downloaded. Valid values are "x86_64" and "aarch64". Default is "x86_64".
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-awscliin-ubuntu-container
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithAwscliinUbuntuContainer()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_awscliin_ubuntu_container()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withAwscliinUbuntuContainer()
}

withTerraformUbuntu() 🔗

WithTerraformUbuntu sets up the container with Terraform on Ubuntu. It updates the package list, installs required dependencies, and then installs the specified version of Terraform.

Parameters: version - The version of Terraform to install. If empty, “latest” will be installed.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of Terraform to install. If empty, it will be installed as "latest".
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-terraform-ubuntu
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithTerraformUbuntu()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_terraform_ubuntu()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withTerraformUbuntu()
}

withTerraformAlpine() 🔗

WithTerraformAlpine sets up the container with Terraform on Alpine Linux. It updates the package list, installs required dependencies, and then installs the specified version of Terraform.

Parameters: version - The version of Terraform to install. If empty, “latest” will be installed.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of Terraform to install. If empty, it will be installed as "latest".
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-terraform-alpine
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithTerraformAlpine()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_terraform_alpine()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withTerraformAlpine()
}

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
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
imageUrlString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 base --image-url string
func (m *myModule) example(imageUrl string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			Base(imageUrl)
}
@function
def example(image_url: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.base(image_url)
	)
@func()
example(imageUrl: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.base(imageUrl)
}

withTerragruntUbuntu() 🔗

WithTerragruntUbuntu sets up the container with Terragrunt and optionally Terraform on Ubuntu. It updates the package list, installs required dependencies, and then installs the specified versions of Terragrunt and Terraform.

Parameters: version - The version of Terragrunt to install. If empty, “latest” will be installed. tfVersion - The version of Terraform to install. If empty, “latest” will be installed. skipTerraform - If true, Terraform installation will be skipped.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of Terragrunt to install. If empty, it will be installed as "latest".
tfVersionString -tfVersion is the version of Terraform to install. If empty, it will be installed as "latest".
skipTerraformBoolean -skipTerraform if true, Terraform installation will be skipped.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-terragrunt-ubuntu
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithTerragruntUbuntu()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_terragrunt_ubuntu()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withTerragruntUbuntu()
}

withTerragruntAlpine() 🔗

WithTerragruntAlpine sets up the container with Terragrunt and optionally Terraform on Alpine Linux. It updates the package list, installs required dependencies, and then installs the specified versions of Terragrunt and Terraform.

Parameters: version - The version of Terragrunt to install. If empty, “latest” will be installed. tfVersion - The version of Terraform to install. If empty, “latest” will be installed. skipTerraform - If true, Terraform installation will be skipped.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of Terragrunt to install. If empty, it will be installed as "latest".
tfVersionString -tfVersion is the version of Terraform to install. If empty, it will be installed as "latest".
skipTerraformBoolean -skipTerraform if true, Terraform installation will be skipped.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-terragrunt-alpine
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithTerragruntAlpine()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_terragrunt_alpine()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withTerragruntAlpine()
}

printEnvVars() 🔗

PrintEnvVars retrieves and prints the environment variables of the container.

It executes the printenv command inside the container to get a list of all environment variables and their respective values.

Arguments: - None.

Returns: - string: A string containing all environment variables in the format “KEY=VALUE”, separated by newlines. - error: An error if the command fails, wrapped with additional context.

Usage example: “`go envVars, err := ModuleTemplateInstance.PrintEnvVars()

if err != nil {
    log.Fatalf("Error retrieving environment variables: %v", err)
}

fmt.Println(envVars).

Return Type
String !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 print-env-vars
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			ModuleTemplate().
			PrintEnvVars(ctx)
}
@function
async def example() -> str:
	return await (
		dag.module_template()
		.print_env_vars()
	)
@func()
async example(): Promise<string> {
	return dag
		.moduleTemplate()
		.printEnvVars()
}

inspectEnvVar() 🔗

InspectEnvVar inspects the value of an environment variable by its key Arguments: - key: The environment variable key to inspect. Returns: - string: The value of the environment variable. - error: An error if the key is invalid or the environment variable is not found.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
keyString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 inspect-env-var --key string
func (m *myModule) example(ctx context.Context, key string) string  {
	return dag.
			ModuleTemplate().
			InspectEnvVar(ctx, key)
}
@function
async def example(key: str) -> str:
	return await (
		dag.module_template()
		.inspect_env_var(key)
	)
@func()
async example(key: string): Promise<string> {
	return dag
		.moduleTemplate()
		.inspectEnvVar(key)
}

newGoServer() 🔗

NewGoServer initializes and returns a new instance of GoServer with the given service name and port.

Parameters:

serviceName string: The name of the service to be created (optional, defaults to “go-server”). port int: The port to expose from the service.

Returns:

*GoServer: An instance of GoServer configured with a container created from the default image and version.

Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
ctrContainer -ctr is the container to use as a base container. If it's not set, it'll create a new container.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
}

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
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-environment-variable --name string --value string
func (m *myModule) example(name string, value string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithEnvironmentVariable(name, value)
}
@function
def example(name: str, value: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_environment_variable(name, value)
	)
@func()
example(name: string, value: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-source --src DIR_PATH
func (m *myModule) example(src *Directory) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithSource(src)
}
@function
def example(src: dagger.Directory) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_source(src)
	)
@func()
example(src: Directory): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-container --ctr IMAGE:TAG
func (m *myModule) example(ctr *Container) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithContainer(ctr)
}
@function
def example(ctr: dagger.Container) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_container(ctr)
	)
@func()
example(ctr: Container): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withContainer(ctr)
}

withDockerService() 🔗

WithDockerService sets up the container with the Docker service.

It sets up the container with the Docker service. Parameters: - dockerVersion: The version of the Docker engine to use, e.g., “v20.10.17”. Optional parameter. If not provided, a default version is used.

Return Type
Service !
Arguments
NameTypeDefault ValueDescription
dockerVersionString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-docker-service --docker-version string
func (m *myModule) example(dockerVersion string) *Service  {
	return dag.
			ModuleTemplate().
			WithDockerService(dockerVersion)
}
@function
def example(docker_version: str) -> dagger.Service:
	return (
		dag.module_template()
		.with_docker_service(docker_version)
	)
@func()
example(dockerVersion: string): Service {
	return dag
		.moduleTemplate()
		.withDockerService(dockerVersion)
}

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
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
fileFile !-No description provided
destString !-No description provided
ownerString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-file-mounted-in-container --file file:path --dest string --owner string
func (m *myModule) example(file *File, dest string, owner string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithFileMountedInContainer(file, dest, owner)
}
@function
def example(file: dagger.File, dest: str, owner: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_file_mounted_in_container(file, dest, owner)
	)
@func()
example(file: File, dest: string, owner: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: The updated ModuleTemplate with the environment variable set.

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

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
nameString !-No description provided
secretSecret !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-secret-as-env-var --name string --secret env:MYSECRET
func (m *myModule) example(name string, secret *Secret) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithSecretAsEnvVar(name, secret)
}
@function
def example(name: str, secret: dagger.Secret) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_secret_as_env_var(name, secret)
	)
@func()
example(name: string, secret: Secret): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: The updated ModuleTemplate with the downloaded file mounted in the container.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-downloaded-file --url string
func (m *myModule) example(url string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithDownloadedFile(url)
}
@function
def example(url: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_downloaded_file(url)
	)
@func()
example(url: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: The updated ModuleTemplate with the cloned repository mounted in the container.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
repoUrlString !-No description provided
tokenString -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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-cloned-git-repo --repo-url string
func (m *myModule) example(repoUrl string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithClonedGitRepo(repoUrl)
}
@function
def example(repo_url: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_cloned_git_repo(repo_url)
	)
@func()
example(repoUrl: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: The updated ModuleTemplate with the cache-busting environment variable set.

Return Type
ModuleTemplate !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-cache-buster
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithCacheBuster()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_cache_buster()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: The updated ModuleTemplate with the config file mounted in the container.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-config-file --cfg-file file:path
func (m *myModule) example(cfgFile *File) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithConfigFile(cfgFile)
}
@function
def example(cfg_file: dagger.File) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_config_file(cfg_file)
	)
@func()
example(cfgFile: File): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withConfigFile(cfgFile)
}

withAwskeys() 🔗

WithAWSKeys sets AWS credentials as environment variables. awsKeyId is the AWS Access Key ID. awsSecretAccessKey is the AWS Secret Access Key. awsSessionToken is the AWS Session Token; optional. awsRegion is the AWS Region; optional. awsProfile is the AWS Profile; optional.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
awsKeyIdSecret !-awsKeyId is the AWS Access Key ID.
awsSecretAccessKeySecret !-awsSecretAccessKey is the AWS Secret Access Key.
awsSessionTokenSecret -awsSessionToken is the AWS Session Token; optional.
awsRegionSecret -awsRegion is the AWS Region; optional.
awsProfileSecret -awsProfile is the AWS Profile; optional.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-awskeys --aws-key-id env:MYSECRET --aws-secret-access-key env:MYSECRET
func (m *myModule) example(awsKeyId *Secret, awsSecretAccessKey *Secret) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithAwskeys(awsKeyId, awsSecretAccessKey)
}
@function
def example(aws_key_id: dagger.Secret, aws_secret_access_key: dagger.Secret) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_awskeys(aws_key_id, aws_secret_access_key)
	)
@func()
example(awsKeyId: Secret, awsSecretAccessKey: Secret): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withAwskeys(awsKeyId, awsSecretAccessKey)
}

withAzureCredentials() 🔗

WithAzureCredentials sets Azure credentials as environment variables. azureClientId is the Azure Client ID. azureClientSecret is the Azure Client Secret. azureTenantId is the Azure Tenant ID.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
azureClientIdSecret !-azureClientId is the Azure Client ID.
azureClientSecretSecret !-azureClientSecret is the Azure Client Secret.
azureTenantIdSecret !-azureTenantId is the Azure Tenant ID.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-azure-credentials --azure-client-id env:MYSECRET --azure-client-secret env:MYSECRET --azure-tenant-id env:MYSECRET
func (m *myModule) example(azureClientId *Secret, azureClientSecret *Secret, azureTenantId *Secret) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithAzureCredentials(azureClientId, azureClientSecret, azureTenantId)
}
@function
def example(azure_client_id: dagger.Secret, azure_client_secret: dagger.Secret, azure_tenant_id: dagger.Secret) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_azure_credentials(azure_client_id, azure_client_secret, azure_tenant_id)
	)
@func()
example(azureClientId: Secret, azureClientSecret: Secret, azureTenantId: Secret): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withAzureCredentials(azureClientId, azureClientSecret, azureTenantId)
}

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: - *ModuleTemplate: A pointer to the updated ModuleTemplate instance.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-platform
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoPlatform()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_platform()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: A pointer to the updated ModuleTemplate instance.

Return Type
ModuleTemplate !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-cgo-enabled
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoCgoEnabled()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_cgo_enabled()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: A pointer to the updated ModuleTemplate instance.

Return Type
ModuleTemplate !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-cgo-disabled
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithCgoDisabled()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_cgo_disabled()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: A pointer to the updated ModuleTemplate instance.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-build-cache
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoBuildCache()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_build_cache()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: A pointer to the updated ModuleTemplate instance.

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-mod-cache
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoModCache()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_mod_cache()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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:

ModuleTemplate.WithGoInstall([]string{"github.com/Excoriate/daggerverse@latest", "github.com/another/package@v1.0"})

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

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
pkgs[String ! ] !-pkgs are the URLs of the packages to install.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-install --pkgs string1 --pkgs string2
func (m *myModule) example(pkgs []string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoInstall(pkgs)
}
@function
def example(pkgs: List[str]) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_install(pkgs)
	)
@func()
example(pkgs: string[]): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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:

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

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

Return Type
ModuleTemplate !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-exec --args string1 --args string2
func (m *myModule) example(args []string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoExec(args)
}
@function
def example(args: List[str]) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_exec(args)
	)
@func()
example(args: string[]): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withGoExec(args)
}

withGoBuild() 🔗

WithGoBuild configures and executes a Go build command within the container environment.

This method builds a Go package based on specified parameters such as package name, race detection, build flags, tags, and output binary name.

Params: - pkg (string) +optional: The Go package to compile. If empty, the package in the current directory is compiled. - race (bool) +optional: Enable data race detection if true. - ldflags ([]string) +optional: Arguments to pass on each go tool link invocation. - tags ([]string) +optional: A list of additional build tags to consider satisfied during the build. - trimpath (bool) +optional: Remove all file system paths from the resulting executable if true. - rawArgs ([]string) +optional: Additional arguments to pass to the build command. - platform (dagger.Platform) +optional: Target platform in “[os]/[platform]/[version]” format, defaults to “linux/amd64”. - output (string) +optional: The output binary name or path. - optimizeSize (bool) +optional: Optimize for size if true. - verbose (bool) +optional: Verbose output if true. - buildMode (string) +optional: Specify the build mode.

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

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
pkgString -pkg is the Go package to compile.
raceBoolean -race enables data race detection.
ldflags[String ! ] -ldflags are arguments to pass on each go tool link invocation.
tags[String ! ] -tags are additional build tags to consider satisfied during the build.
trimpathBoolean -trimpath removes all file system paths from the resulting executable.
rawArgs[String ! ] -rawArgs are additional arguments to pass to the build command.
platformScalar -platform is the target platform in "[os]/[platform]/[version]" format, defaults to "linux/amd64".
outputString -output specifies the output binary name or path.
optimizeSizeBoolean -optimizeSize optimizes for size.
verboseBoolean -verbose enables verbose output.
buildModeString -buildMode specifies the build mode.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-build
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoBuild()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_build()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withGoBuild()
}

withGoPrivate() 🔗

WithGoPrivate configures the GOPRIVATE environment variable for the container environment.

This method sets the GOPRIVATE variable, which is used by the Go toolchain to identify private modules or repositories that should not be fetched from public proxies.

Parameters: - privateHost (string): The hostname of the private host for the Go packages or modules.

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

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
privateHostString !-privateHost is the hostname of the private host for the Go packages or modules.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-private --private-host string
func (m *myModule) example(privateHost string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoPrivate(privateHost)
}
@function
def example(private_host: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_private(private_host)
	)
@func()
example(privateHost: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withGoPrivate(privateHost)
}

withGoGcccompiler() 🔗

WithGoGCCCompiler installs the GCC compiler and development tools in the container environment.

This method uses the Alpine package manager (apk) to install the GCC compiler along with musl-dev, which is the development package of the standard C library on Alpine.

Example usage:

ModuleTemplate.WithGCCCompiler()

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

Return Type
ModuleTemplate !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-gcccompiler
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoGcccompiler()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_gcccompiler()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withGoGcccompiler()
}

withGoTestSum() 🔗

WithGoTestSum installs the GoTestSum tool and optionally its dependency tparse in the container environment.

This method installs gotest.tools/gotestsum using the specified version, and optionally installs github.com/mfridman/tparse using a specified version, unless the skipTParse flag is set to true.

Parameters: - goTestSumVersion (string) +optional: The version of GoTestSum to use, e.g., “v0.8.0”. If empty, it defaults to “latest”. - tParseVersion (string) +optional: The version of TParse to use, e.g., “v0.8.0”. If empty, it defaults to the same version as goTestSumVersion. - skipTParse (bool) +optional: If true, TParse will not be installed. Default is false.

Example:

m := &ModuleTemplate{}
m.WithGoTestSum("v0.8.0", "v0.7.0", false)   // Install specific versions
m.WithGoTestSum("", "", true)                // Install latest version of GoTestSum and skip TParse

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

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
goTestSumVersionString -goTestSumVersion is the version of GoTestSum to use, e.g., "v0.8.0".
tParseVersionString -tParseVersion is the version of TParse to use, e.g., "v0.8.0".
skipTparseBoolean -skipTParse is a flag to indicate whether TParse should be skipped.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-test-sum
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoTestSum()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_test_sum()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withGoTestSum()
}

withGoReleaser() 🔗

WithGoReleaser installs the GoReleaser tool in the container environment.

This method installs goreleaser using the specified version. Check https://goreleaser.com/install/

Parameters: - version (string): The version of GoReleaser to use, e.g., “v2@latest”.

Example:

m := &ModuleTemplate{}
m.WithGoReleaser("v2.2.0")  // Install GoReleaser version 2.2.0

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

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of GoReleaser to use, e.g., By default, it's set "v2@latest".
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-releaser
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoReleaser()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_releaser()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withGoReleaser()
}

withGoLint() 🔗

WithGoLint installs the GoLint tool in the container environment.

This method installs golangci-lint using the specified version.

Parameters: - version (string): The version of GoLint to use, e.g., “v1.60.1”.

Example:

m := &ModuleTemplate{}
m.WithGoLint("v1.60.1")  // Install GoLint version 1.60.1

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

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
versionString !-version is the version of GoLint to use, e.g., "v1.60.1".
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-go-lint --version string
func (m *myModule) example(version string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGoLint(version)
}
@function
def example(version: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_go_lint(version)
	)
@func()
example(version: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withGoLint(version)
}

withHttpcurl() 🔗

WithHTTPCurl sets up the HTTP client and configuration for the ModuleTemplate You can configure various options like headers, authentication, etc.

Example:

module := &ModuleTemplate{}
module = module.WithHTTP("https://api.example.com",
                         []string{"Content-Type=application/json"},
                         time.Second*30,
                         "basic", "username:password")

Parameters: - baseURL: The base URL for the HTTP requests. - headers: A slice of headers to include in the HTTP requests, formatted as “Header=Value” strings. - timeout: The timeout duration for the HTTP client. - authType: The type of authentication (e.g., “basic”, “bearer”). - authCredentials: The credentials for the specified authentication type.

Returns: - A pointer to the updated ModuleTemplate.

Return Type
ModuleTemplate !
Arguments
NameTypeDefault ValueDescription
baseUrlString !-baseURL is the base URL for the HTTP requests.
headers[String ! ] -headers is a slice of headers to include in the HTTP requests, formatted as "Header=Value" strings.
timeoutString -timeout is the timeout duration for the HTTP client.
authTypeString -authType is the type of authentication (e.g., "basic", "bearer").
authCredentialsString -authCredentials is the credentials for the specified authentication type.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-httpcurl --base-url string
func (m *myModule) example(baseUrl string) *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithHttpcurl(baseUrl)
}
@function
def example(base_url: str) -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_httpcurl(base_url)
	)
@func()
example(baseUrl: string): ModuleTemplate {
	return dag
		.moduleTemplate()
		.withHttpcurl(baseUrl)
}

doHttprequest() 🔗

DoHTTPRequest sets up the HTTP client and configuration for the ModuleTemplate You can configure various options like headers, authentication, etc.

Example:

module := &ModuleTemplate{}
module = module.DoHTTPRequest(ctx, "GET", "https://api.example.com",
                              []string{"Content-Type=application/json"},
                              time.Second*30,
                              "basic", "username:password", "")

Parameters: - ctx: The context for the HTTP request. - method: The HTTP method (e.g., “GET”, “POST”). - baseURL: The base URL for the HTTP requests. - headers: A slice of headers to include in the HTTP requests, formatted as “Header=Value” strings. - timeout: The timeout duration for the HTTP client. - authType: The type of authentication (e.g., “basic”, “bearer”). - authCredentials: The credentials for the specified authentication type. - body: The request body for POST requests (can be empty string for GET requests).

Returns: - A pointer to the updated ModuleTemplate.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
methodString !-method is the HTTP method (e.g., "GET", "POST").
baseUrlString !-baseURL is the base URL for the HTTP requests.
headers[String ! ] -headers is a slice of headers to include in the HTTP requests, formatted as "Header=Value" strings.
timeoutString -timeout is the timeout duration for the HTTP client.
authTypeString -authType is the type of authentication (e.g., "basic", "bearer").
authCredentialsString -authCredentials is the credentials for the specified authentication type.
bodyString -body is the request body for POST requests (can be empty string for GET requests).
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 do-httprequest --method string --base-url string
func (m *myModule) example(method string, baseUrl string) *Container  {
	return dag.
			ModuleTemplate().
			DoHttprequest(method, baseUrl)
}
@function
def example(method: str, base_url: str) -> dagger.Container:
	return (
		dag.module_template()
		.do_httprequest(method, base_url)
	)
@func()
example(method: string, baseUrl: string): Container {
	return dag
		.moduleTemplate()
		.doHttprequest(method, baseUrl)
}

doJsonapicall() 🔗

DoJSONAPICall performs an API call and returns the JSON response as a dagger.File.

Example:

module := &ModuleTemplate{}
jsonFile, err := module.DoJSONAPICall(ctx, "POST", "https://api.example.com/data",
                                      []string{"Content-Type=application/json"},
                                      time.Second*30,
                                      "bearer", "your-token-here",
                                      `{"key": "value"}`)

Parameters: - ctx: The context for the HTTP request. - method: The HTTP method (e.g., “GET”, “POST”). - baseURL: The base URL for the HTTP requests. - headers: A slice of headers to include in the HTTP requests, formatted as “Header=Value” strings. - timeout: The timeout duration for the HTTP client. - authType: The type of authentication (e.g., “basic”, “bearer”). - authCredentials: The credentials for the specified authentication type. - body: The JSON request body for POST requests (can be empty string for GET requests).

Returns: - A dagger.File containing the JSON response. - An error if the request fails or the response is not JSON.

Return Type
File !
Arguments
NameTypeDefault ValueDescription
methodString !-method is the HTTP method (e.g., "GET", "POST").
baseUrlString !-baseURL is the base URL for the HTTP requests.
headers[String ! ] -headers is a slice of headers to include in the HTTP requests, formatted as "Header=Value" strings.
timeoutString -timeout is the timeout duration for the HTTP client.
authTypeString -authType is the type of authentication (e.g., "basic", "bearer").
authCredentialsString -authCredentials is the credentials for the specified authentication type.
bodyString -body is the JSON request body for POST requests (can be empty string for GET requests).
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 do-jsonapicall --method string --base-url string
func (m *myModule) example(method string, baseUrl string) *File  {
	return dag.
			ModuleTemplate().
			DoJsonapicall(method, baseUrl)
}
@function
def example(method: str, base_url: str) -> dagger.File:
	return (
		dag.module_template()
		.do_jsonapicall(method, base_url)
	)
@func()
example(method: string, baseUrl: string): File {
	return dag
		.moduleTemplate()
		.doJsonapicall(method, baseUrl)
}

withGitInAlpineContainer() 🔗

WithGitInAlpineContainer installs Git in the golang/alpine container.

It installs Git in the golang/alpine container.

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

withGitInUbuntuContainer() 🔗

WithGitInUbuntuContainer installs Git in the Ubuntu-based container.

This method installs Git in the Ubuntu-based container.

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

Return Type
ModuleTemplate !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-git-in-ubuntu-container
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithGitInUbuntuContainer()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_git_in_ubuntu_container()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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
ModuleTemplate !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 with-utilities-in-alpine-container
func (m *myModule) example() *ModuleTemplate  {
	return dag.
			ModuleTemplate().
			WithUtilitiesInAlpineContainer()
}
@function
def example() -> dag.ModuleTemplate:
	return (
		dag.module_template()
		.with_utilities_in_alpine_container()
	)
@func()
example(): ModuleTemplate {
	return dag
		.moduleTemplate()
		.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: - *ModuleTemplate: The updated ModuleTemplate with the utilities installed in the container.

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

ModuleTemplateGoServer 🔗

GoServer represents a Go-based server configuration.

withServerData() 🔗

WithServerData configures the GoServer to use a cache volume at a specified path with specified sharing mode and ownership.

This method mounts a cache volume inside the container at the provided path, with specified sharing mode and ownership details. If any of these parameters are not provided, default values will be used.

Parameters:

path string: (optional) The path to the cache volume’s root. Defaults to “/data” if not provided. share dagger.CacheSharingMode: (optional) The sharing mode of the cache volume. Defaults to “shared” if not provided. owner string: (optional) The owner of the cache volume. Defaults to “1000:1000” if not provided.

Returns:

*GoServer: An instance of GoServer configured with the specified cache volume settings.

Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
pathString -path is the path to the cache volume's root. If not provided, it defaults to "/data".
shareEnum -share is the sharing mode of the cache volume. If not provided, it defaults to "shared".
ownerString -owner is the owner of the cache volume. If not provided, it defaults to "1000:1000".
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-server-data
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithServerData()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_server_data()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withServerData()
}

withBinaryName() 🔗

WithBinaryName sets the name of the binary to be built for the GoServer.

This method allows specifying a custom name for the binary to be built and used within the server container. If the binary name is not explicitly set, the default binary name (“app”) will be used.

Parameters:

binaryName string: The name of the binary to build.

Returns:

*GoServer: An instance of GoServer configured with the specified binary name.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
binaryNameString !-binaryName is the name of the binary to build.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-binary-name --binary-name string
func (m *myModule) example(binaryName string) *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithBinaryName(binaryName)
}
@function
def example(binary_name: str) -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_binary_name(binary_name)
	)
@func()
example(binaryName: string): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withBinaryName(binaryName)
}

withPreBuiltContainer() 🔗

WithPreBuiltContainer configures the GoServer to use a pre-existing container as its base.

This method allows setting an already created container as the base for the GoServer, overriding any previously set container.

Parameters:

ctr *dagger.Container: The container to use as a base container.

Returns:

*GoServer: An instance of GoServer configured with the provided container.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-ctr is the container to use as a base container.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-pre-built-container --ctr IMAGE:TAG
func (m *myModule) example(ctr *Container) *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithPreBuiltContainer(ctr)
}
@function
def example(ctr: dagger.Container) -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_pre_built_container(ctr)
	)
@func()
example(ctr: Container): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withPreBuiltContainer(ctr)
}

withExposePort() 🔗

WithExposePort sets the port to expose from the service.

This method allows setting the port to expose from the service.

Parameters:

port int: The port to expose from the service.

Returns:

*GoServer: An instance of GoServer configured with the provided port.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
portInteger !-ports is a list of ports to expose from the service.
skipHealthcheckBoolean -skipHealthcheck is a flag to skip the health check when run as a service.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-expose-port --port integer
func (m *myModule) example(port int) *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithExposePort(port)
}
@function
def example(port: int) -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_expose_port(port)
	)
@func()
example(port: number): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withExposePort(port)
}

withSource() 🔗

WithSource mounts the source directory inside the container and sets the working directory.

This method configures the GoServer to mount the provided source directory at a fixed mount point and optionally set a specific working directory within the container. If the working directory is not provided, it defaults to the mount point.

Parameters:

src *dagger.Directory: The directory containing all the source code, including the module directory.
workdir string: (optional) The working directory within the container, defaults to "/mnt".

Returns:

*GoServer: An instance of GoServer configured with the provided source directory and working directory.
Return Type
ModuleTemplateGoServer !
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@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-source --src DIR_PATH
func (m *myModule) example(src *Directory) *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithSource(src)
}
@function
def example(src: dagger.Directory) -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_source(src)
	)
@func()
example(src: Directory): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withSource(src)
}

withCompileOptions() 🔗

WithCompileOptions executes a user-defined compilation command within the container.

This method allows appending custom arguments to the “go build -o app” command for compiling the Go server. It always defaults to “go build -o app” but allows additional arguments such as verbose output, module mode, and build tags to customize the build process.

Parameters:

extraArgs []string: (optional) Extra arguments to append to the "go build -o app" command.
verbose bool: (optional) Flag to enable verbose output (adds the -v flag to the command).
mod string: (optional) Sets the module download mode (adds the -mod flag to the command).
tags string: (optional) A comma-separated list of build tags to consider
satisfied during the build (adds the -tags flag to the command).

Returns:

*GoServer: An instance of GoServer configured with the custom compilation command and any additional flags.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
extraArgs[String ! ] -extraArgs are additional arguments to append to the go build command.
verboseBoolean -verbose is a flag to enable verbose output.
modString -mod is the module download mode for the build.
tagsString -tags is a comma-separated list of build tags to consider satisfied during the build.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-compile-options
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithCompileOptions()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_compile_options()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withCompileOptions()
}

withRunOptions() 🔗

WithRunOptions adds extra arguments to the command when running the Go server binary.

This method allows additional arguments to be appended when running the server binary. Normally, the server is run as “./binary”, but if the binary that represents the Go server receives flags or additional arguments, these should be passed through this function.

Parameters:

runCmd []string: A list of additional command-line arguments to pass
when executing the server binary.

Returns:

*GoServer: An instance of GoServer configured to run the binary with the specified arguments.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
runFlags[String ! ] !-runCmd is a list of additional command-line arguments to pass when executing the server binary.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-run-options --run-flags string1 --run-flags string2
func (m *myModule) example(runFlags []string) *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithRunOptions(runFlags)
}
@function
def example(run_flags: List[str]) -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_run_options(run_flags)
	)
@func()
example(runFlags: string[]): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withRunOptions(runFlags)
}

withGoProxy() 🔗

WithGoProxy sets the Go Proxy URL for the service.

Parameters:

goproxy string: URL for the Go Proxy. If empty, defaults to "https://proxy.golang.org,direct".

Returns:

*GoServer: The GoServer instance for method chaining.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
goproxyString -goproxy is the Go Proxy URL for the service.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-go-proxy
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithGoProxy()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_go_proxy()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withGoProxy()
}

withDnsresolver() 🔗

WithDNSResolver sets the DNS resolver for the service.

Parameters:

dnsResolver string: DNS resolver used by the service. If empty, defaults to "8.8.8.8 8.8.4.4".

Returns:

*GoServer: The GoServer instance for method chaining.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
dnsResolverString -dnsResolver is the DNS resolver used by the service.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-dnsresolver
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithDnsresolver()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_dnsresolver()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withDnsresolver()
}

withGarbageCollectionSettings() 🔗

WithGarbageCollectionSettings sets the garbage collection optimization for the Go runtime.

Parameters:

gogc string: Garbage collection optimization value. If empty, defaults to "100".

Returns:

*GoServer: The GoServer instance for method chaining.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
gogcString -gogc is the garbage collection optimization for the Go runtime.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-garbage-collection-settings
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithGarbageCollectionSettings()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_garbage_collection_settings()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withGarbageCollectionSettings()
}

withGoEnvironment() 🔗

WithGoEnvironment sets the Go environment for the service.

Parameters:

goEnv string: The Go environment. If empty, defaults to "production".

Returns:

*GoServer: The GoServer instance for method chaining.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
goEnvString -goEnv is the Go environment.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-go-environment
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithGoEnvironment()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_go_environment()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withGoEnvironment()
}

withMaxProcs() 🔗

WithMaxProcs sets the maximum number of CPU cores to use.

Parameters:

goMaxProcs int: Maximum number of CPU cores to use. If 0, defaults to the number of available CPU cores.

Returns:

*GoServer: The GoServer instance for method chaining.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
goMaxProcsInteger -goMaxProcs is the maximum number of CPU cores to use.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-max-procs
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithMaxProcs()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_max_procs()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withMaxProcs()
}

withDebugOptions() 🔗

WithDebugOptions sets debug options for the Go runtime.

Parameters:

goDebug string: Debug options for Go. If empty, defaults to "http2debug=1".

Returns:

*GoServer: The GoServer instance for method chaining.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
goDebugString -goDebug is the debug options for the Go runtime.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-debug-options
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithDebugOptions()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_debug_options()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withDebugOptions()
}

withRuntimeThreadLock() 🔗

WithRuntimeThreadLock optimizes the number of threads in system calls.

Parameters:

runtimeLockOsThread string: Optimizes number of threads in system calls. If empty, defaults to "1".

Returns:

*GoServer: The GoServer instance for method chaining.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
runtimeLockOsThreadString -runtimeLockOsThread Optimizes number of threads in system calls.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-runtime-thread-lock
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithRuntimeThreadLock()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_runtime_thread_lock()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withRuntimeThreadLock()
}

withHttpsettings() 🔗

WithHTTPSettings sets HTTP-related settings for the service.

Parameters:

maxConns string: Maximum number of concurrent HTTP connections. If empty, defaults to "1000".
keepAlive string: Enables HTTP Keep-Alive. If empty, defaults to "1".

Returns:

*GoServer: The GoServer instance for method chaining.
Return Type
ModuleTemplateGoServer !
Arguments
NameTypeDefault ValueDescription
maxConnsString -maxConns is the maximum number of concurrent HTTP connections.
keepAliveString -keepAlive is the HTTP Keep-Alive setting.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 with-httpsettings
func (m *myModule) example() *ModuleTemplateGoServer  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			WithHttpsettings()
}
@function
def example() -> dag.ModuleTemplateGoServer:
	return (
		dag.module_template()
		.new_go_server()
		.with_httpsettings()
	)
@func()
example(): ModuleTemplateGoServer {
	return dag
		.moduleTemplate()
		.newGoServer()
		.withHttpsettings()
}

initService() 🔗

InitService sets up a basic Go service with the provided container and exposes the specified ports.

Returns:

*dagger.Service: The configured service with the specified ports exposed.
Return Type
Service !
Arguments
NameTypeDefault ValueDescription
ctrContainer -ctr is the container to use as a base container.
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 init-service
func (m *myModule) example() *Service  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			InitService()
}
@function
def example() -> dagger.Service:
	return (
		dag.module_template()
		.new_go_server()
		.init_service()
	)
@func()
example(): Service {
	return dag
		.moduleTemplate()
		.newGoServer()
		.initService()
}

initContainer() 🔗

InitContainer initializes the container with the default build and run commands.

This method sets up the container for the Go server. If custom compilation or run commands have not been provided, it defaults to building the server binary using “go build” and running the server binary directly.

Returns:

*dagger.Container: The initialized container with the default or custom commands.
Return Type
Container !
Example
dagger -m github.com/Excoriate/daggerverse/module-template@440ec77817b1f3853fd65b2a321e4763e25cb60f call \
 new-go-server \
 init-container
func (m *myModule) example() *Container  {
	return dag.
			ModuleTemplate().
			NewGoServer().
			InitContainer()
}
@function
def example() -> dagger.Container:
	return (
		dag.module_template()
		.new_go_server()
		.init_container()
	)
@func()
example(): Container {
	return dag
		.moduleTemplate()
		.newGoServer()
		.initContainer()
}