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@07d9b49f4de704c27f9823ea498575314560dba4Entrypoint
Return Type
Build Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 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
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobAttempt | String ! | - | No description provided |
| repository | String ! | - | No description provided |
| ref | String ! | - | No description provided |
| path | String ! | - | No description provided |
| job | String ! | - | No description provided |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
build-docker --job-attempt string --repository string --ref string --path string --job stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobAttempt | String | - | No description provided |
| repository | String ! | - | No description provided |
| ref | String | - | No description provided |
| path | String | - | No description provided |
| job | String | - | No description provided |
| framework | String ! | - | No description provided |
| dependenciesCmd | String | - | Override the default install command (e.g. "go mod tidy && go mod download") |
| buildCmd | String | - | Override the default build command (e.g. "go build -o /app ./cmd/server") |
| exposedPort | Integer | - | No description provided |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
build-go-binary --repository string --framework stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobAttempt | String | - | No description provided |
| repository | String ! | - | No description provided |
| ref | String | - | No description provided |
| path | String | - | No description provided |
| job | String | - | No description provided |
| framework | String ! | - | No description provided |
| dependenciesCmd | String | - | Override the default install command (e.g. "mvn dependency:go-offline") |
| buildCmd | String | - | Override the default build command (e.g. "mvn package -Pprod -DskipTests") |
| exposedPort | Integer | - | No description provided |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
build-java-maven --repository string --framework stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobAttempt | String | - | No description provided |
| repository | String ! | - | No description provided |
| ref | String | - | No description provided |
| path | String | - | No description provided |
| job | String | - | No description provided |
| framework | String ! | - | No description provided |
| packageManager | String | - | No description provided |
| dependenciesCmd | String | - | No description provided |
| buildCmd | String | - | No description provided |
| exposedPort | Integer | - | No description provided |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
build-node-server --repository string --framework stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobAttempt | String | - | No description provided |
| repository | String ! | - | No description provided |
| ref | String | - | No description provided |
| path | String | - | No description provided |
| job | String | - | No description provided |
| framework | String ! | - | No description provided |
| dependenciesCmd | String | - | Override the default install command (e.g. "pip install -e .") |
| buildCmd | String | - | Override the default build command (not used for most Python apps) |
| exposedPort | Integer | - | No description provided |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
build-python-server --repository string --framework stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobAttempt | String | - | No description provided |
| repository | String ! | - | No description provided |
| ref | String | - | No description provided |
| path | String | - | No description provided |
| job | String | - | No description provided |
| framework | String ! | - | No description provided |
| dependenciesCmd | String | - | Override the default install command (not typically used for Rust) |
| buildCmd | String | - | Override the default build command (e.g. "cargo build --release --bin myapp") |
| exposedPort | Integer | - | No description provided |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
build-rust-binary --repository string --framework stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobAttempt | String | - | No description provided |
| repository | String ! | - | No description provided |
| ref | String | - | No description provided |
| path | String | - | No description provided |
| job | String | - | No description provided |
| framework | String ! | - | No description provided |
| packageManager | String | - | No description provided |
| dependenciesCmd | String | - | No description provided |
| buildCmd | String | - | No description provided |
| exposedPort | Integer | - | No description provided |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
build-static-nginx --repository string --framework stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobAttempt | String | - | No description provided |
| repository | String ! | - | No description provided |
| ref | String | - | No description provided |
| path | String | - | No description provided |
| job | String | - | No description provided |
| packageManager | String | - | No description provided |
| dependenciesCmd | String | - | No description provided |
| buildCmd | String | - | No description provided |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
npm-build --repository stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory ! | - | No description provided |
| jobAttempt | String ! | - | No description provided |
| job | String ! | - | No description provided |
| packageManager | String ! | - | No description provided |
| dependenciesCmd | String ! | - | No description provided |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
npm-install --source DIR_PATH --job-attempt string --job string --package-manager string --dependencies-cmd stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| jobAttempt | String | - | No description provided |
| repository | String ! | - | No description provided |
| ref | String | - | No description provided |
| path | String | - | No description provided |
| job | String | - | No description provided |
| framework | String ! | - | No description provided |
| packageManager | String | - | No description provided |
| dependenciesCmd | String | - | Override the default install command (e.g. "npm ci --legacy-peer-deps") |
| buildCmd | String | - | Override the default build command (e.g. "npm run build:prod") |
| exposedPort | Integer | - | No description provided |
| imageName | String ! | - | Image name for the registry (e.g. project ID) |
| commitHash | String ! | - | Commit hash used as the image tag |
| registryUrl | String ! | - | Registry URL (e.g. 192.168.1.150:30082) |
| registryUser | String ! | - | Registry username |
| registryPassword | Secret ! | - | Registry password |
Example
dagger -m github.com/antonkad/build-image@07d9b49f4de704c27f9823ea498575314560dba4 call \
publish --repository string --framework string --image-name string --commit-hash string --registry-url string --registry-user string --registry-password env:MYSECRETfunc (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@07d9b49f4de704c27f9823ea498575314560dba4 call \
testfunc (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()
}