Struct ImageBuildOptsBuilder

Source
pub struct ImageBuildOptsBuilder { /* private fields */ }
Expand description

A builder struct for ImageBuildOpts.

Implementations§

Source§

impl ImageBuildOptsBuilder

Source

pub fn new(path: impl Into<String>) -> Self

A builder struct for ImageBuildOpts.

Parameters:

  • path - Path to a build context directory
Source

pub fn build(self) -> ImageBuildOpts

Finish building ImageBuildOpts.

Source§

impl ImageBuildOptsBuilder

Source

pub fn all_platforms(self, all_platforms: bool) -> Self

Instead of building for a set of platforms specified using the platform option, inspect the build’s base images, and build for all of the platforms that are available. Stages that use scratch as a starting point can not be inspected, so at least one non-scratch stage must be present for detection to work usefully.

Source

pub fn build_args<K, V>( self, build_args: impl IntoIterator<Item = (K, V)>, ) -> Self
where K: Serialize + Eq + Hash, V: Serialize,

Key-value build time variables.

Source

pub fn cache_from<S>(self, images: impl IntoIterator<Item = S>) -> Self
where S: Into<String>,

List of images used to build cache resolution

Source

pub fn cpu_period(self, cpu_period: isize) -> Self

Limits the CPU CFS (Completely Fair Scheduler) period.

Source

pub fn cpu_quota(self, cpu_quota: isize) -> Self

Limits the CPU CFS (Completely Fair Scheduler) quota.

Source

pub fn cpu_set_cpus(self, cpu_set_cpus: isize) -> Self

Set CPUs in which to allow execution. Example: 0-1, 1-3

Source

pub fn cpu_shares(self, cpu_shares: isize) -> Self

CPU shares - relative weights

Source

pub fn dockerfile(self, dockerfile: impl Into<String>) -> Self

Path within the build context to the Dockerfile. This is ignored if remote is specified and points to an external Dockerfile.

Source

pub fn extra_hosts(self, extra_hosts: impl Into<String>) -> Self

Extra hosts to add to /etc/hosts.

Source

pub fn force_rm(self, force_rm: bool) -> Self

Always remove intermediate containers, even upon failure.

Source

pub fn http_proxy(self, http_proxy: bool) -> Self

Inject http proxy environment variables into container.

Source

pub fn labels<K, V>(self, labels: impl IntoIterator<Item = (K, V)>) -> Self
where K: Serialize + Eq + Hash, V: Serialize,

Key-value pairs to set as labels on the new image.

Source

pub fn layers(self, layers: bool) -> Self

Cache intermediate layers during build.

Source

pub fn memory(self, memory: usize) -> Self

The upper limit (in bytes) on how much memory running containers can use.

Source

pub fn memswap(self, memswap: usize) -> Self

Limits the amount of memory and swap together.

Source

pub fn network_mode(self, network_mode: NetworkMode) -> Self

Set the networking mode for the run commands during build.

Source

pub fn no_cache(self, no_cache: bool) -> Self

Do not use the cache when building the image.

Source

pub fn outputs(self, outputs: impl Into<String>) -> Self

Output configuration.

Source

pub fn platform(self, platform: Platform) -> Self

Source

pub fn pull(self, pull: bool) -> Self

Attempt to pull the image even if an older image exists locally.

Source

pub fn quiet(self, quiet: bool) -> Self

Suppress verbose build output.

Source

pub fn remote(self, remote: impl Into<String>) -> Self

A Git repository URI or HTTP/HTTPS context URI. If the URI points to a single text file, the file’s contents are placed into a file called Dockerfile and the image is built from that file. If the URI points to a tarball, the file is downloaded by the daemon and the contents therein used as the context for the build. If the URI points to a tarball and the dockerfile parameter is also specified, there must be a file with the corresponding path inside the tarball.

Source

pub fn remove(self, remove: bool) -> Self

Remove intermediate containers after a successful build.

Source

pub fn shared_mem_size(self, shared_mem_size: usize) -> Self

Value to use when mounting an shmfs on the container’s /dev/shm directory. Default is 64MB

Source

pub fn squash(self, squash: bool) -> Self

Silently ignored. Squash the resulting images layers into a single layer.

Source

pub fn tag(self, tag: impl Into<String>) -> Self

A name and optional tag to apply to the image in the name:tag format.

Source

pub fn target(self, target: impl Into<String>) -> Self

Target build stage

Source

pub fn unset_env<S>(self, unset_env: impl IntoIterator<Item = S>) -> Self
where S: Into<String>,

Unset environment variables from the final image.

Trait Implementations§

Source§

impl Clone for ImageBuildOptsBuilder

Source§

fn clone(&self) -> ImageBuildOptsBuilder

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ImageBuildOptsBuilder

Source§

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

Formats the value using the given formatter. 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> 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
Source§

impl<T> ErasedDestructor for T
where T: 'static,