Skip to main content

BuildOptions

Struct BuildOptions 

Source
pub struct BuildOptions {
Show 20 fields pub dockerfile: Option<PathBuf>, pub zimagefile: Option<PathBuf>, pub runtime: Option<Runtime>, pub build_args: HashMap<String, String>, pub target: Option<String>, pub tags: Vec<String>, pub no_cache: bool, pub push: bool, pub registry_auth: Option<RegistryAuth>, pub squash: bool, pub format: Option<String>, pub layers: bool, pub cache_from: Option<String>, pub cache_to: Option<String>, pub cache_ttl: Option<Duration>, pub default_registry: Option<String>, pub default_cache_mounts: Vec<RunMount>, pub retries: u32, pub platform: Option<String>, pub source_hash: Option<String>,
}
Expand description

Build options for customizing the image build process

Fields§

§dockerfile: Option<PathBuf>

Dockerfile path (default: Dockerfile in context)

§zimagefile: Option<PathBuf>

ZImagefile path (alternative to Dockerfile)

§runtime: Option<Runtime>

Use runtime template instead of Dockerfile

§build_args: HashMap<String, String>

Build arguments (ARG values)

§target: Option<String>

Target stage for multi-stage builds

§tags: Vec<String>

Image tags to apply

§no_cache: bool

Disable layer caching

§push: bool

Push to registry after build

§registry_auth: Option<RegistryAuth>

Registry auth (if pushing)

§squash: bool

Squash all layers into one

§format: Option<String>

Image format (oci or docker)

§layers: bool

Enable buildah layer caching (–layers flag for buildah build). Default: true

Note: ZLayer uses manual container creation (buildah from, buildah run, buildah commit) rather than buildah build, so this flag is reserved for future use when/if we switch to buildah build (bud) command.

§cache_from: Option<String>

Registry to pull cache from (–cache-from for buildah build).

Note: This would be used with buildah build --cache-from=<registry>. Currently ZLayer uses manual container creation, so this is reserved for future implementation or for switching to buildah build.

TODO: Implement remote cache support. This would require either:

  1. Switching to buildah build command which supports –cache-from natively
  2. Implementing custom layer caching with registry push/pull for intermediate layers
§cache_to: Option<String>

Registry to push cache to (–cache-to for buildah build).

Note: This would be used with buildah build --cache-to=<registry>. Currently ZLayer uses manual container creation, so this is reserved for future implementation or for switching to buildah build.

TODO: Implement remote cache support. This would require either:

  1. Switching to buildah build command which supports –cache-to natively
  2. Implementing custom layer caching with registry push/pull for intermediate layers
§cache_ttl: Option<Duration>

Maximum cache age (–cache-ttl for buildah build).

Note: This would be used with buildah build --cache-ttl=<duration>. Currently ZLayer uses manual container creation, so this is reserved for future implementation or for switching to buildah build.

TODO: Implement cache TTL support. This would require either:

  1. Switching to buildah build command which supports –cache-ttl natively
  2. Implementing custom cache expiration logic for our layer caching system
§default_registry: Option<String>

Default OCI/WASM-compatible registry to check for images before falling back to Docker Hub qualification.

When set, the builder will probe this registry for short image names before qualifying them to docker.io. For example, if set to "git.example.com:5000" and the ZImagefile uses base: "myapp:latest", the builder will check git.example.com:5000/myapp:latest first.

§default_cache_mounts: Vec<RunMount>

Default cache mounts injected into all RUN instructions. These are merged with any step-level cache mounts (deduped by target path).

§retries: u32

Number of retries for failed RUN steps (0 = no retries, default)

§platform: Option<String>

Target platform for the build (e.g., “linux/amd64”, “linux/arm64”). When set, buildah from pulls the platform-specific image variant.

§source_hash: Option<String>

SHA-256 hash of the source Dockerfile/ZImagefile content.

When set, the sandbox builder can skip a rebuild if the cached image was produced from identical source content (content-based invalidation).

Trait Implementations§

Source§

impl Clone for BuildOptions

Source§

fn clone(&self) -> BuildOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BuildOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BuildOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more