pub struct ImageBuilder<'a> { /* private fields */ }Expand description
Builder for building Docker images with a fluent API.
Implementations§
Source§impl<'a> ImageBuilder<'a>
impl<'a> ImageBuilder<'a>
Sourcepub fn dockerfile(self, path: impl Into<String>) -> Self
pub fn dockerfile(self, path: impl Into<String>) -> Self
Set the path to the Dockerfile (relative to context).
§Example
client.images()
.build("my-app:latest")
.dockerfile("docker/app.Dockerfile")
.context(std::path::Path::new("."))
.execute()
.await?;Sourcepub fn build_arg(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn build_arg(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a build argument.
§Example
client.images()
.build("my-app:latest")
.build_arg("RUNTIME_IMAGE", "alpine:latest")
.build_arg("VERSION", "1.0.0")
.execute()
.await?;Sourcepub fn label(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn label(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a label to the image.
Sourcepub fn target(self, target: impl Into<String>) -> Self
pub fn target(self, target: impl Into<String>) -> Self
Set the target build stage (for multi-stage builds).
§Example
client.images()
.build("my-app:latest")
.target("production")
.execute()
.await?;Sourcepub fn cache_from(self, image: impl Into<String>) -> Self
pub fn cache_from(self, image: impl Into<String>) -> Self
Add an image to use for build cache.
Sourcepub fn remove_intermediate(self, rm: bool) -> Self
pub fn remove_intermediate(self, rm: bool) -> Self
Remove intermediate containers after build (default: true).
Auto Trait Implementations§
impl<'a> Freeze for ImageBuilder<'a>
impl<'a> !RefUnwindSafe for ImageBuilder<'a>
impl<'a> Send for ImageBuilder<'a>
impl<'a> Sync for ImageBuilder<'a>
impl<'a> Unpin for ImageBuilder<'a>
impl<'a> !UnwindSafe for ImageBuilder<'a>
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
Mutably borrows from an owned value. Read more