pub struct ZImage {Show 20 fields
pub version: Option<String>,
pub runtime: Option<String>,
pub base: Option<String>,
pub build: Option<ZBuildContext>,
pub steps: Vec<ZStep>,
pub platform: Option<String>,
pub os: Option<ImageOs>,
pub stages: Option<IndexMap<String, ZStage>>,
pub wasm: Option<ZWasmConfig>,
pub env: HashMap<String, String>,
pub workdir: Option<String>,
pub expose: Option<ZExpose>,
pub cmd: Option<ZCommand>,
pub entrypoint: Option<ZCommand>,
pub user: Option<String>,
pub labels: HashMap<String, String>,
pub volumes: Vec<String>,
pub healthcheck: Option<ZHealthcheck>,
pub stopsignal: Option<String>,
pub args: HashMap<String, String>,
}Expand description
Top-level ZImagefile representation.
Exactly one of the four mode fields must be set:
runtimefor runtime template shorthandbase+stepsfor single-stage buildsstagesfor multi-stage buildswasmfor WebAssembly component builds
Common image metadata fields (env, workdir, expose, cmd, etc.) apply to the final output image regardless of mode.
Fields§
§version: Option<String>ZImagefile format version (currently must be “1”)
runtime: Option<String>Runtime template name, e.g. “node22”, “python313”, “rust”
base: Option<String>Base image for single-stage builds (e.g. “alpine:3.19”).
Mutually exclusive with build.
build: Option<ZBuildContext>Build a base image from a local Dockerfile/ZImagefile context.
Mutually exclusive with base.
steps: Vec<ZStep>Build steps for single-stage mode
platform: Option<String>Target platform for single-stage mode (e.g. “linux/amd64”)
os: Option<ImageOs>Target OS for this image/stage. Overrides any OS inferred from platform. Default: inferred or Linux.
stages: Option<IndexMap<String, ZStage>>Named stages for multi-stage builds. Insertion order is preserved; the last stage is the output image.
wasm: Option<ZWasmConfig>WebAssembly build configuration
env: HashMap<String, String>Environment variables applied to the final image
workdir: Option<String>Working directory for the final image
expose: Option<ZExpose>Ports to expose
cmd: Option<ZCommand>Default command (CMD equivalent)
entrypoint: Option<ZCommand>Entrypoint command
user: Option<String>User to run as in the final image
labels: HashMap<String, String>Image labels / metadata
volumes: Vec<String>Volume mount points
healthcheck: Option<ZHealthcheck>Healthcheck configuration
stopsignal: Option<String>Signal to send when stopping the container
args: HashMap<String, String>Build arguments (name -> default value)
Implementations§
Source§impl ZImage
impl ZImage
Sourcepub fn resolve_target_os(&self) -> Option<ImageOs>
pub fn resolve_target_os(&self) -> Option<ImageOs>
Resolve the target OS for this image from the explicit os: field,
falling back to the OS portion of platform: if present, else None.
Returns None when neither field gives a definitive answer — callers
should interpret that as “default to Linux” (i.e. the historical
behaviour for all existing ZImagefiles).
A malformed platform: value (one that does not parse to a known
ImageOs) is ignored here on purpose: platform: has historically
been a free-form string and arch-only values like "amd64" must
continue to work. Callers wanting strict validation should use
[ImageOs::from_str] directly.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ZImage
impl<'de> Deserialize<'de> for ZImage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ZImage
impl RefUnwindSafe for ZImage
impl Send for ZImage
impl Sync for ZImage
impl Unpin for ZImage
impl UnsafeUnpin for ZImage
impl UnwindSafe for ZImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more