summaryrefslogtreecommitdiffstats
path: root/examples/imagebuild.rs
blob: 80d825c3e859e8c88a783adea07278a379d15a64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use futures::StreamExt;
use shiplift::{BuildOptions, Docker};
use std::env;

#[tokio::main]
async fn main() {
    let docker = Docker::new();
    let path = env::args().nth(1).expect("You need to specify a path");

    let options = BuildOptions::builder(path).tag("shiplift_test").build();

    let images = docker.images();

    let mut stream = images.build(&options);

    while let Some(build_result) = stream.next().await {
        match build_result {
            Ok(output) => println!("{:?}", output),
            Err(e) => eprintln!("Error: {}", e),
        }
    }
}