Dagger
Search

build

Builds container images from Git repositories. Each language ecosystem
(JS, Go, Python, Rust) lives in its own file and registers framework
configs via init(). Publish() routes to the right builder based on
the framework's Builder field.

Installation

dagger install github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae

Entrypoint

Return Type
Build
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
func (m *MyModule) Example() *dagger.Build  {
	return dag.
			Build()
}
@function
def example() -> dagger.Build:
	return (
		dag.build()
	)
@func()
example(): Build {
	return dag
		.build()
}

Types

Build 🔗

buildDocker() 🔗

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
jobAttemptString !-No description provided
repositoryString !-No description provided
refString !-No description provided
pathString !-No description provided
jobString !-No description provided
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 build-docker --job-attempt string --repository string --ref string --path string --job string
func (m *MyModule) Example(jobAttempt string, repository string, ref string, path string, job string) *dagger.Container  {
	return dag.
			Build().
			BuildDocker(jobAttempt, repository, ref, path, job)
}
@function
def example(job_attempt: str, repository: str, ref: str, path: str, job: str) -> dagger.Container:
	return (
		dag.build()
		.build_docker(job_attempt, repository, ref, path, job)
	)
@func()
example(jobAttempt: string, repository: string, ref: string, path: string, job: string): Container {
	return dag
		.build()
		.buildDocker(jobAttempt, repository, ref, path, job)
}

buildGoBinary() 🔗

BuildGoBinary builds a Go app into a static binary and packages it in a minimal distroless image. Multi-stage: golang:1.24-alpine (build) → gcr.io/distroless/static (runtime). Covers all Go frameworks (Gin, Fiber, Echo, net/http).

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
jobAttemptString -No description provided
repositoryString !-No description provided
refString -No description provided
pathString -No description provided
jobString -No description provided
frameworkString !-No description provided
dependenciesCmdString -Override the default install command (e.g. "go mod tidy && go mod download")
buildCmdString -Override the default build command (e.g. "go build -o /app ./cmd/server")
exposedPortInteger -No description provided
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 build-go-binary --repository string --framework string
func (m *MyModule) Example(repository string, framework string) *dagger.Container  {
	return dag.
			Build().
			BuildGoBinary(repository, framework)
}
@function
def example(repository: str, framework: str) -> dagger.Container:
	return (
		dag.build()
		.build_go_binary(repository, framework)
	)
@func()
example(repository: string, framework: string): Container {
	return dag
		.build()
		.buildGoBinary(repository, framework)
}

buildJavaMaven() 🔗

BuildJavaMaven builds a Spring Boot (Maven) app using a multi-stage build. Build stage: maven:3.9-eclipse-temurin-21 — runs mvn package to produce a fat JAR. Runtime stage: eclipse-temurin:21-jre-alpine — copies the JAR into a minimal JRE image.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
jobAttemptString -No description provided
repositoryString !-No description provided
refString -No description provided
pathString -No description provided
jobString -No description provided
frameworkString !-No description provided
dependenciesCmdString -Override the default install command (e.g. "mvn dependency:go-offline")
buildCmdString -Override the default build command (e.g. "mvn package -Pprod -DskipTests")
exposedPortInteger -No description provided
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 build-java-maven --repository string --framework string
func (m *MyModule) Example(repository string, framework string) *dagger.Container  {
	return dag.
			Build().
			BuildJavaMaven(repository, framework)
}
@function
def example(repository: str, framework: str) -> dagger.Container:
	return (
		dag.build()
		.build_java_maven(repository, framework)
	)
@func()
example(repository: string, framework: string): Container {
	return dag
		.build()
		.buildJavaMaven(repository, framework)
}

buildNodeServer() 🔗

BuildNodeServer builds a JS app and runs it with node. Used for: nextjs, nuxt, remix, sveltekit, astro (SSR), etc.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
jobAttemptString -No description provided
repositoryString !-No description provided
refString -No description provided
pathString -No description provided
jobString -No description provided
frameworkString !-No description provided
packageManagerString -No description provided
dependenciesCmdString -No description provided
buildCmdString -No description provided
exposedPortInteger -No description provided
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 build-node-server --repository string --framework string
func (m *MyModule) Example(repository string, framework string) *dagger.Container  {
	return dag.
			Build().
			BuildNodeServer(repository, framework)
}
@function
def example(repository: str, framework: str) -> dagger.Container:
	return (
		dag.build()
		.build_node_server(repository, framework)
	)
@func()
example(repository: string, framework: string): Container {
	return dag
		.build()
		.buildNodeServer(repository, framework)
}

buildPythonServer() 🔗

BuildPythonServer builds a Python app and packages it in a slim runtime image. Covers FastAPI (uvicorn), Flask (gunicorn), and Django (gunicorn).

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
jobAttemptString -No description provided
repositoryString !-No description provided
refString -No description provided
pathString -No description provided
jobString -No description provided
frameworkString !-No description provided
dependenciesCmdString -Override the default install command (e.g. "pip install -e .")
buildCmdString -Override the default build command (not used for most Python apps)
exposedPortInteger -No description provided
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 build-python-server --repository string --framework string
func (m *MyModule) Example(repository string, framework string) *dagger.Container  {
	return dag.
			Build().
			BuildPythonServer(repository, framework)
}
@function
def example(repository: str, framework: str) -> dagger.Container:
	return (
		dag.build()
		.build_python_server(repository, framework)
	)
@func()
example(repository: string, framework: string): Container {
	return dag
		.build()
		.buildPythonServer(repository, framework)
}

buildRustBinary() 🔗

BuildRustBinary builds a Rust app into a release binary and packages it in a minimal distroless image. Multi-stage: rust:1.77-slim (build) → gcr.io/distroless/cc (runtime). Covers all Rust web frameworks (Axum, Actix, Rocket, Warp). The binary name is extracted from Cargo.toml automatically.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
jobAttemptString -No description provided
repositoryString !-No description provided
refString -No description provided
pathString -No description provided
jobString -No description provided
frameworkString !-No description provided
dependenciesCmdString -Override the default install command (not typically used for Rust)
buildCmdString -Override the default build command (e.g. "cargo build --release --bin myapp")
exposedPortInteger -No description provided
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 build-rust-binary --repository string --framework string
func (m *MyModule) Example(repository string, framework string) *dagger.Container  {
	return dag.
			Build().
			BuildRustBinary(repository, framework)
}
@function
def example(repository: str, framework: str) -> dagger.Container:
	return (
		dag.build()
		.build_rust_binary(repository, framework)
	)
@func()
example(repository: string, framework: string): Container {
	return dag
		.build()
		.buildRustBinary(repository, framework)
}

buildStaticNginx() 🔗

BuildStaticNginx builds a JS app and serves the output with nginx. Used for: react, vue, svelte, angular, vite, astro (static), gatsby, etc.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
jobAttemptString -No description provided
repositoryString !-No description provided
refString -No description provided
pathString -No description provided
jobString -No description provided
frameworkString !-No description provided
packageManagerString -No description provided
dependenciesCmdString -No description provided
buildCmdString -No description provided
exposedPortInteger -No description provided
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 build-static-nginx --repository string --framework string
func (m *MyModule) Example(repository string, framework string) *dagger.Container  {
	return dag.
			Build().
			BuildStaticNginx(repository, framework)
}
@function
def example(repository: str, framework: str) -> dagger.Container:
	return (
		dag.build()
		.build_static_nginx(repository, framework)
	)
@func()
example(repository: string, framework: string): Container {
	return dag
		.build()
		.buildStaticNginx(repository, framework)
}

npmBuild() 🔗

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
jobAttemptString -No description provided
repositoryString !-No description provided
refString -No description provided
pathString -No description provided
jobString -No description provided
packageManagerString -No description provided
dependenciesCmdString -No description provided
buildCmdString -No description provided
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 npm-build --repository string
func (m *MyModule) Example(repository string) *dagger.Container  {
	return dag.
			Build().
			NpmBuild(repository)
}
@function
def example(repository: str) -> dagger.Container:
	return (
		dag.build()
		.npm_build(repository)
	)
@func()
example(repository: string): Container {
	return dag
		.build()
		.npmBuild(repository)
}

npmInstall() 🔗

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-No description provided
jobAttemptString !-No description provided
jobString !-No description provided
packageManagerString !-No description provided
dependenciesCmdString !-No description provided
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 npm-install --source DIR_PATH --job-attempt string --job string --package-manager string --dependencies-cmd string
func (m *MyModule) Example(source *dagger.Directory, jobAttempt string, job string, packageManager string, dependenciesCmd string) *dagger.Container  {
	return dag.
			Build().
			NpmInstall(source, jobAttempt, job, packageManager, dependenciesCmd)
}
@function
def example(source: dagger.Directory, job_attempt: str, job: str, package_manager: str, dependencies_cmd: str) -> dagger.Container:
	return (
		dag.build()
		.npm_install(source, job_attempt, job, package_manager, dependencies_cmd)
	)
@func()
example(source: Directory, jobAttempt: string, job: string, packageManager: string, dependenciesCmd: string): Container {
	return dag
		.build()
		.npmInstall(source, jobAttempt, job, packageManager, dependenciesCmd)
}

publish() 🔗

Return Type
String !
Arguments
NameTypeDefault ValueDescription
jobAttemptString -No description provided
repositoryString !-No description provided
refString -No description provided
pathString -No description provided
jobString -No description provided
frameworkString !-No description provided
packageManagerString -No description provided
dependenciesCmdString -Override the default install command (e.g. "npm ci --legacy-peer-deps")
buildCmdString -Override the default build command (e.g. "npm run build:prod")
exposedPortInteger -No description provided
imageNameString !-Image name for the registry (e.g. project ID)
commitHashString !-Commit hash used as the image tag
registryUrlString !-Registry URL (e.g. 192.168.1.150:30082)
registryUserString !-Registry username
registryPasswordSecret !-Registry password
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 publish --repository string --framework string --image-name string --commit-hash string --registry-url string --registry-user string --registry-password env:MYSECRET
func (m *MyModule) Example(ctx context.Context, repository string, framework string, imageName string, commitHash string, registryUrl string, registryUser string, registryPassword *dagger.Secret) string  {
	return dag.
			Build().
			Publish(ctxrepository, framework, imageName, commitHash, registryUrl, registryUser, registryPassword)
}
@function
async def example(repository: str, framework: str, image_name: str, commit_hash: str, registry_url: str, registry_user: str, registry_password: dagger.Secret) -> str:
	return await (
		dag.build()
		.publish(repository, framework, image_name, commit_hash, registry_url, registry_user, registry_password)
	)
@func()
async example(repository: string, framework: string, imageName: string, commitHash: string, registryUrl: string, registryUser: string, registryPassword: Secret): Promise<string> {
	return dag
		.build()
		.publish(repository, framework, imageName, commitHash, registryUrl, registryUser, registryPassword)
}

test() 🔗

Return Type
Container !
Example
dagger -m github.com/antonkad/build-image@21e96f431dc2bfaff106a55e0ec72d3a802ea1ae call \
 test
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Build().
			Test()
}
@function
def example() -> dagger.Container:
	return (
		dag.build()
		.test()
	)
@func()
example(): Container {
	return dag
		.build()
		.test()
}