use dagger_rust::build::{RustVersion, SlimImage};

#[tokio::main]
pub async fn main() -> eyre::Result<()> {
    dagger_sdk::connect(|client| async move {
        let rust_build = dagger_rust::build::RustBuild::new(client.clone());

        let containers = rust_build
            .build_release(
                Some("testdata"),
                RustVersion::Nightly,
                &["crates/*"],
                &["openssl"],
                vec![SlimImage::Debian {
                    image: "debian:bookworm".into(),
                    deps: vec!["openssl".into()],
                    architecture: dagger_rust::build::BuildArchitecture::Amd64,
                }],
                "example_bin",
            )
            .await?;

        for container in containers {
            container.sync().await?;
        }

        Ok(())
    })
    .await?;
    Ok(())
}
