Documentation
¶
Overview ¶
Package builder builds an OCI image from a Containerfile by driving the engine: each step runs in a container made from the previous step's image, which is then committed — RUN executes a WebAssembly program there, COPY and ADD extract a computed layer into it, and metadata instructions (ENV, LABEL, CMD, …) commit an empty layer with the new configuration, so the image's history has one entry per instruction.
The builder reads only the Containerfile and the build context it is given (in memory); it never opens a host path and fetches nothing from the network itself. Steps are cached by parent image, resulting configuration, instruction and input digest.
Index ¶
Constants ¶
const ( MaxConfigBytes = 1 << 20 MaxVarBytes = 1 << 20 )
MaxConfigBytes bounds an image configuration (the engine reads configs of at most 4 MiB) and, with MaxVarBytes, what ENV and ARG can hold.
const MaxLayers = 127
MaxLayers keeps a build below the engine's 128-layer bound.
const Platform = "wasip1/wasm"
Platform is the only platform the engine runs.
Variables ¶
var DefaultShell = []string{"/bin/sh", "-c"}
DefaultShell runs shell-form RUN, CMD and ENTRYPOINT unless SHELL says otherwise.
Functions ¶
func DefaultCachePath ¶
DefaultCachePath is where wctr build keeps its cache natively.
Types ¶
type Cache ¶
Cache maps a step's cache key — the parent image, the image config the step produces, the step itself and the digest of its inputs — to the image a previous build committed for it. A hit is used only after the engine confirms the image still exists.
type FileCache ¶
type FileCache struct {
*MemoryCache
// contains filtered or unexported fields
}
FileCache is a MemoryCache kept in a JSON file between builds.
func OpenFileCache ¶
OpenFileCache loads path (a missing file is an empty cache; a damaged one is discarded: the cache only ever saves work).
type MemoryCache ¶
type MemoryCache struct {
Max int
// contains filtered or unexported fields
}
MemoryCache is a bounded in-memory Cache (the oldest entries go first).
func NewMemoryCache ¶
func NewMemoryCache(max int) *MemoryCache
NewMemoryCache holds at most max entries (4096 when max <= 0).
type Options ¶
type Options struct {
// Containerfile is the file's content; Name is shown in messages.
Containerfile []byte
Name string
// Context is the build context (nil: empty).
Context *buildcontext.Context
// Ignored says the context was filtered by an ignore file.
Ignored bool
BuildArgs map[string]string
// Target is the stage to build (default: the last).
Target string
Tags []string
NoCache bool
Engine driver.Engine
// Cache (nil: a cache for this build only).
Cache Cache
// Out receives the plain progress output (nil: discarded).
Out io.Writer
// MaxSteps bounds the instructions executed, ONBUILD triggers
// included (default 1000).
MaxSteps int
// Limits bound COPY/ADD layers and --from sources.
Limits buildcontext.Limits
}
Options of one build.