Directory layout
A stack is a directory whose name is the stack’s component name:stacks/ directory to distribute it:
The manifest
stack.yaml is a thin descriptor:
The Dockerfile fragments
The two fragment files are the substance of a stack. They are Docker build snippets that clawker composes into the generated image at the right point:Dockerfile.stack-root.tmplrenders as root, before the container user is created — use it for system-level installs.Dockerfile.stack-user.tmplrenders as the container user, after the user switch — use it for per-user tooling.
Self-guard your install
A stack must be safe to declare unconditionally, because the same name can be provisioned by more than one build stratum and images may already carry the runtime. Guard each fragment so it skips itself when the runtime is already present:ARG (as above) lets consumers override it with
clawker build --build-arg MYTOOL_VERSION=2.0.
Fragments are Go text templates, so a handful of build-context variables are
available for interpolation. The shipped
node, go, python, and rust
stacks are the best working reference for the guard pattern, GPG/checksum
verification, and the available template variables — copy their shape when
writing your own.How a stack renders
A project-declared stack (build.stacks) renders in the shared base image,
before your root_run/user_run instructions, so your build steps can rely on
it. A stack a harness declares as a dependency renders in that harness image.
Both strata render even when they share a name — your self-guard handles any
overlap. See Image Customization for the full build ordering.
Validating
Bundle a stack and validate it before publishing:clawker build does, so a missing
fragment or malformed stack.yaml fails here instead of at build time.
Validation checks the bundle envelope and component naming; the fragments prove
out at clawker build time.