dockerfile-rs

Crates.iodockerfile-rs
lib.rsdockerfile-rs
version0.3.0
sourcesrc
created_at2019-02-17 10:42:53.030741
updated_at2019-04-04 20:24:16.911218
descriptionCorrect Dockerfile generator library
homepage
repositoryhttps://github.com/ark0f/dockerfile.rs
max_upload_size
id115337
size58,976
Arsenii Lyashenko (ark0f)

documentation

https://docs.rs/dockerfile-rs

README

dockerfile-rs

Build Status License crates.io API docs Codecov

Correct Dockerfile generator library

Quick start

use std::{io::{Result, Write}, fs::File};
use dockerfile_rs::{DockerFile, FROM};

fn main() -> Result<()> {
    let docker_file = DockerFile::from(FROM!(nginx:latest))
        .comment("open port for server")
        .expose(80)
        .copy((".", "."))
        .cmd(vec!["echo", "Hello from container!"]);

    // write into file
    let mut file = File::create("nginx.Dockerfile")?;
    write!(&mut file, "{}", docker_file)?;
    
    Ok(())
}

Generated file:

FROM nginx:latest

# open port for server
EXPOSE 80
COPY . .

CMD ["echo", "Hello from container!"]

Changelog

License

dockerfile-rs under either of:

at your option.

Commit count: 38

cargo fmt