How Builds Work
A build turns a build context (your source plus a Dockerfile) into a container image pushed to your organizationβs registry. Builds run remotely with KanikoΒ and are fully asynchronous.
Context sources
Every build supplies its context exactly one of three ways:
| Source | When to use it | How |
|---|---|---|
| Inline zip | Small projects (< 4 MB packed) | The context is sent inline with CreateBuild (zippedCode). The CLI tars your directory for you. |
| Uploaded context | Larger trees | Upload once via UploadBuildContext (gRPC client-stream, or dodil ignite build upload), then pass the returned contextId to CreateBuild. |
| Git | Source already in a repo | Pass a gitSource (url, reference β branch/tag/SHA, default main, and an optional contextDir subpath). Kaniko clones it directly β no upload. |
The builder
Builds use Kaniko with a Dockerfile (path set by dockerfile, default Dockerfile). A standalone build always requires a Dockerfile.
Building from source without a Dockerfile β where the platform auto-detects a builder β is a Compute feature, reached through the draft/compile flow, not through BuildService directly. The
dodilCLI can also scaffold a starter Dockerfile for common stacks when one is missing (see CLI Guide).
What you control on each build:
tagsβ image tags (defaults tolatest).buildArgsβ Docker build args (map<string, string>).platformβ target platform, e.g.linux/amd64.noCacheβ disable layer caching for a clean build.timeoutSecsβ build timeout (0uses the platform default).
Lifecycle
CreateBuild validates the request, queues the build, and returns a build_id with status BUILD_STATUS_PENDING right away β it never blocks on the build finishing.
PENDING βββΆ RUNNING βββΆ SUCCEEDED
ββββΆ FAILED
ββββΆ CANCELLED (via CancelBuild)- Follow progress with
StreamBuildLogsβ keyed bybuild_id.fromStart: truereplays the full persisted log; otherwise it tails from now. - Inspect a build with
GetBuild(or list them withListBuilds, filterable by status). A finished build carriesmetricsβdurationMs,imageSizeBytes,layerCount, and whether the cache was used. - Cancel an in-flight build with
CancelBuild.
Output and the Compute hand-off
A successful build pushes the image to your organizationβs registry and records the full references in imageRefs (registry/your-org/name:tag). The target registry and repository are managed by the platform β you donβt set them.
That image is what an image-mode app version in Compute runs. When you compile a draft from an image source, Compute dispatches the build, waits for it, and wires the resulting image reference onto the version automatically. You can also reference a buildβs imageRefs yourself as a Bring-Your-Own-Image deploy β see Bring Your Own Image.
Credentials
Private base images and private git repos need credentials. BuildService stores them per organization with SaveBuildSecrets β one call carries three groups:
registryCredentialsβ registry auth for pushing built images and pulling private base images.gitCredentialsβ a username + token (PAT) for cloning private repos; applied automatically togitSourcebuilds.buildSecretsβ extra values exposed to the build as build args. (Secret values are redacted to***when a build is read back.)
This per-org store is distinct from the named-slot model Computeβs Bring-Your-Own-Image deploys use (a
registry_secret_refpointing at a SecretService slot). Builds reference their orgβs stored credentials implicitly; they donβt name a slot per build.
See also
- Quickstart β build and run in four steps
- CLI Guide β the
dodil ignite buildcommands - API Reference β per-RPC request/response contracts
- Compute image-mode Β· Secrets