pub struct DockerFile { /* private fields */ }
Expand description
Dockerfile
generator
§Example
use std::{io::Write, fs::File};
use dockerfile_rs::{DockerFile, Copy, FROM};
let docker_file = DockerFile::from(FROM!(nginx:latest))
.comment("open port for server")
.expose(80)
.copy(Copy {
src: ".".to_string(),
dst: ".".to_string(),
from: None,
chown: None,
})
.cmd(vec!["echo", "Hello from container!"]);
// write into file
let mut file = File::create("nginx.Dockerfile")?;
write!(&mut file, "{}", docker_file)?;
Implementations§
Source§impl DockerFile
impl DockerFile
pub fn from(from: From) -> Self
Sourcepub fn maintainer<T: Into<Maintainer> + 'static>(self, maintainer: T) -> Self
pub fn maintainer<T: Into<Maintainer> + 'static>(self, maintainer: T) -> Self
Can be defined just once, only last function call will have effect
Deprecated, use label
with maintainer
key instead
Sourcepub fn entry_point<T: Into<EntryPoint> + 'static>(self, entry_point: T) -> Self
pub fn entry_point<T: Into<EntryPoint> + 'static>(self, entry_point: T) -> Self
Can be defined just once, only last function call will have effect
Sourcepub fn cmd<T: Into<Cmd> + 'static>(self, cmd: T) -> Self
pub fn cmd<T: Into<Cmd> + 'static>(self, cmd: T) -> Self
Can be defined just once, only last function call will have effect
pub fn run<T: Into<Run> + 'static>(self, run: T) -> Self
pub fn label<T: Into<Label> + 'static>(self, label: T) -> Self
pub fn expose<T: Into<Expose> + 'static>(self, expose: T) -> Self
pub fn env<T: Into<Env> + 'static>(self, env: T) -> Self
pub fn add(self, add: Add) -> Self
pub fn copy(self, copy: Copy) -> Self
pub fn volume<T: Into<Volume> + 'static>(self, volume: T) -> Self
pub fn user(self, user: User) -> Self
pub fn work_dir<T: Into<WorkDir> + 'static>(self, work_dir: T) -> Self
pub fn arg<T: Into<Arg> + 'static>(self, arg: T) -> Self
pub fn stop_signal<T: Into<StopSignal> + 'static>(self, stop_signal: T) -> Self
pub fn health_check(self, health_check: HealthCheck) -> Self
pub fn shell<T: Into<Shell> + 'static>(self, shell: T) -> Self
pub fn comment<T: Into<Comment> + 'static>(self, comment: T) -> Self
pub fn on_build<T: Into<OnBuild> + 'static>(self, on_build: T) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DockerFile
impl !RefUnwindSafe for DockerFile
impl !Send for DockerFile
impl !Sync for DockerFile
impl Unpin for DockerFile
impl !UnwindSafe for DockerFile
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