dagger-rs/crates/dagger-sdk/examples/existing-dockerfile/main.rs

22 lines
482 B
Rust
Raw Normal View History

2023-02-17 17:50:45 +01:00
use rand::Rng;
#[tokio::main]
async fn main() -> eyre::Result<()> {
2023-02-17 17:50:45 +01:00
let mut rng = rand::thread_rng();
let client = dagger_sdk::connect()?;
2023-02-17 17:50:45 +01:00
let context_dir = client
.host()
.directory("./examples/existing-dockerfile/app");
2023-02-17 17:50:45 +01:00
let ref_ = client
.container()
.build(context_dir.id().await?)
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>())).await?;
2023-02-17 17:50:45 +01:00
println!("published image to: {}", ref_);
Ok(())
}