Rewrite an assembled Stevedore.Image — config, annotations, tag, base, or layer set — without
re-pulling layers where possible. Every mutation recomputes the dependent digests through
Stevedore.Image.assemble/3; bytes that don't change keep their digests.
Spec: crane mutate/rebase/flatten semantics
(https://github.com/google/go-containerregistry/tree/main/cmd/crane) and OCI image-spec
config.md/layer.md.
Summary
Functions
Merges annotations into the manifest's annotations. Config and layers are untouched.
Rewrites the runtime config. changes is a map of :entrypoint/:cmd/:env/:user/
:working_dir/:labels (labels are merged, the rest replaced) or a (Config.t -> Config.t)
function. Layers are untouched.
Flattens all layers into a single layer, applying whiteouts (.wh.<name> deletions and
.wh..wh..opq opaque dirs) so the result is the effective filesystem. The runtime config is
preserved.
Rebases image from old_base onto new_base: the bottom layers matching old_base are
swapped for new_base's layers, keeping the application layers on top. Fails with
:base_mismatch if image doesn't actually start with old_base's layers.
Sets the tag the image will be written under by a subsequent copy.
Functions
@spec annotations(Stevedore.Image.t(), map()) :: Stevedore.Image.t()
Merges annotations into the manifest's annotations. Config and layers are untouched.
@spec config( Stevedore.Image.t(), map() | (Stevedore.Config.t() -> Stevedore.Config.t()) ) :: Stevedore.Image.t()
Rewrites the runtime config. changes is a map of :entrypoint/:cmd/:env/:user/
:working_dir/:labels (labels are merged, the rest replaced) or a (Config.t -> Config.t)
function. Layers are untouched.
@spec flatten( Stevedore.Image.t(), keyword() ) :: {:ok, Stevedore.Image.t()} | {:error, term()}
Flattens all layers into a single layer, applying whiteouts (.wh.<name> deletions and
.wh..wh..opq opaque dirs) so the result is the effective filesystem. The runtime config is
preserved.
@spec rebase(Stevedore.Image.t(), Stevedore.Image.t(), Stevedore.Image.t()) :: {:ok, Stevedore.Image.t()} | {:error, :base_mismatch}
Rebases image from old_base onto new_base: the bottom layers matching old_base are
swapped for new_base's layers, keeping the application layers on top. Fails with
:base_mismatch if image doesn't actually start with old_base's layers.
@spec retag(Stevedore.Image.t(), String.t()) :: Stevedore.Image.t()
Sets the tag the image will be written under by a subsequent copy.