Dagger
Search

image

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

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

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

Installation

dagger install github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b

Entrypoint

Return Type
Image !
Arguments
NameTypeDefault ValueDescription
baseHadolintContainerContainer -base hadolint container It need contain hadolint
buildContainerContainer -The external build of container Usefull when need build args
Example
dagger -m github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b call \
func (m *MyModule) Example() *dagger.Image  {
	return dag.
			Image()
}
@function
def example() -> dagger.Image:
	return (
		dag.image()
	)
@func()
example(): Image {
	return dag
		.image()
}

Types

Image 🔗

build() 🔗

Build permit to build image from Dockerfile

Return Type
Build !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-

the source directory

dockerfileString "Dockerfile"

The dockerfile path

withDirectories[Directory ! ] -

Set extra directories

Example
dagger -m github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b call \
 build --source DIR_PATH
func (m *MyModule) Example(source *dagger.Directory) *dagger.ImageBuild  {
	return dag.
			Image().
			Build(source)
}
@function
def example(source: dagger.Directory) -> dagger.ImageBuild:
	return (
		dag.image()
		.build(source)
	)
@func()
example(source: Directory): ImageBuild {
	return dag
		.image()
		.build(source)
}

ci() 🔗

Ci runs lint, build, and push (when enabled) as a single CI entrypoint.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-

Source directory

dockerfileString "Dockerfile"

Dockerfile path

ciBoolean -

Run in ci: push the image to the registry

registryString -

The registry server

repositoryNameString -

The repository name

versionString -

The image version to publish

registryUsernameSecret -

The registry username

registryPasswordSecret -

The registry password

dryRunBoolean -

Dry-run: skip the push and its requirement checks even when ci is set

Example
dagger -m github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b call \
 ci --source DIR_PATH
func (m *MyModule) Example(source *dagger.Directory) *dagger.Directory  {
	return dag.
			Image().
			Ci(source)
}
@function
def example(source: dagger.Directory) -> dagger.Directory:
	return (
		dag.image()
		.ci(source)
	)
@func()
example(source: Directory): Directory {
	return dag
		.image()
		.ci(source)
}

generateCi() 🔗

GenerateCi generates CI pipeline files for the given CI system.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
ciString !-

The CI runner: github, jenkins, or gitlab

dockerfileString "Dockerfile"

Dockerfile path to lint and build

branches[String ! ] ["main"]

Branches that trigger the pipeline

daggerVersionString -

Dagger CLI version to use in CI (empty = engine default)

registryString -

OCI registry URL where the image is pushed. Required by the generated pipeline (it runs with –ci true).

repositoryString -

Repository path inside the registry. Required when registry is set.

defaultBranchString "main"

Branch commits land here when running on a tag.

moduleRefString -

Configurable dagger module reference. Defaults to this module’s current version (auto-detected).

registryUsernameKeyString -

GitHub: secret name for registry username (empty = github.actor).

registryPasswordKeyString -

GitHub: secret name for registry password (empty = GITHUB_TOKEN).

registryCredentialString -

Jenkins: credential id for registry username/password.

gitTokenCredentialString -

Jenkins: credential id for git token.

registryUsernameVarString -

GitLab: CI/CD variable name for registry username.

registryPasswordVarString -

GitLab: CI/CD variable name for registry password.

gitTokenVarString -

GitLab: CI/CD variable name for git token.

daggerKubernetesTokenString -

Jenkins: dagger kubernetes token credential ID. When set, the Jenkinsfile uses the daggerKubernetes shared library step.

daggerKubernetesUrlString -

Jenkins: dagger kubernetes server URL.

forceDaggerMdBoolean -

Force overwrite DAGGER.md even if it already exists in source.

Example
dagger -m github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b call \
 generate-ci --ci string
func (m *MyModule) Example(ci string) *dagger.Directory  {
	return dag.
			Image().
			Generateci(ci)
}
@function
def example(ci: str) -> dagger.Directory:
	return (
		dag.image()
		.generateci(ci)
	)
@func()
example(ci: string): Directory {
	return dag
		.image()
		.generateCi(ci)
}

getBaseHadolintContainer() 🔗

GetBaseHadolintContainer return the default image for hadolint

Return Type
Container !
Example
dagger -m github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b call \
 get-base-hadolint-container
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Image().
			Getbasehadolintcontainer()
}
@function
def example() -> dagger.Container:
	return (
		dag.image()
		.getbasehadolintcontainer()
	)
@func()
example(): Container {
	return dag
		.image()
		.getBaseHadolintContainer()
}

lint() 🔗

Lint permit to lint dockerfile image

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-

the source directory

dockerfileString -

The dockerfile path

thresholdString -

The failure threshold

Example
dagger -m github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b call \
 lint --source DIR_PATH
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory) string  {
	return dag.
			Image().
			Lint(ctx, source)
}
@function
async def example(source: dagger.Directory) -> str:
	return await (
		dag.image()
		.lint(source)
	)
@func()
async example(source: Directory): Promise<string> {
	return dag
		.image()
		.lint(source)
}

withBuildArg() 🔗

Return Type
Image !
Arguments
NameTypeDefault ValueDescription
nameString !-

The build ard name

valString !-

The build arg value

Example
dagger -m github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b call \
 with-build-arg --name string --val string
func (m *MyModule) Example(name string, val string) *dagger.Image  {
	return dag.
			Image().
			Withbuildarg(name, val)
}
@function
def example(name: str, val: str) -> dagger.Image:
	return (
		dag.image()
		.withbuildarg(name, val)
	)
@func()
example(name: string, val: string): Image {
	return dag
		.image()
		.withBuildArg(name, val)
}

Build 🔗

getContainer() 🔗

GetContainer permit to get the container

Return Type
Container !
Example
dagger -m github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b call \
 build --source DIR_PATH \
 get-container
func (m *MyModule) Example(source *dagger.Directory) *dagger.Container  {
	return dag.
			Image().
			Build(source).
			Getcontainer()
}
@function
def example(source: dagger.Directory) -> dagger.Container:
	return (
		dag.image()
		.build(source)
		.getcontainer()
	)
@func()
example(source: Directory): Container {
	return dag
		.image()
		.build(source)
		.getContainer()
}

push() 🔗

Push permit to push image

Return Type
String !
Arguments
NameTypeDefault ValueDescription
repositoryNameString !-

The repository name

versionString !-

The version

withRegistryUsernameSecret -

The registry username

withRegistryPasswordSecret -

The registry password

registryUrlString !-

The registry url

Example
dagger -m github.com/disaster37/dagger-library-go/image@6dc20d4b87a358515dd2f2ddb932f1868ce80d4b call \
 build --source DIR_PATH \
 push --repository-name string --version string --registry-url string
func (m *MyModule) Example(ctx context.Context, source *dagger.Directory, repositoryName string, version string, registryUrl string) string  {
	return dag.
			Image().
			Build(source).
			Push(ctx, repositoryName, version, registryUrl)
}
@function
async def example(source: dagger.Directory, repositoryname: str, version: str, registryurl: str) -> str:
	return await (
		dag.image()
		.build(source)
		.push(repositoryname, version, registryurl)
	)
@func()
async example(source: Directory, repositoryName: string, version: string, registryUrl: string): Promise<string> {
	return dag
		.image()
		.build(source)
		.push(repositoryName, version, registryUrl)
}