mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2024-11-13 20:32:17 +01:00
64 lines
1.6 KiB
Rust
64 lines
1.6 KiB
Rust
use dagger_sdk::{
|
|
ContainerBuildOptsBuilder, HostDirectoryOpts, QueryContainerOpts, QueryContainerOptsBuilder,
|
|
};
|
|
|
|
static PLATFORMS: [&str; 2] = ["linux/arm64", "linux/x86_64"];
|
|
|
|
#[tokio::test]
|
|
async fn test_issue_30_alt() -> eyre::Result<()> {
|
|
let client = dagger_sdk::connect().await?;
|
|
|
|
let context = client.host().directory_opts(
|
|
".",
|
|
HostDirectoryOpts {
|
|
exclude: Some(vec!["target", "client/node_modules", "client/build"]),
|
|
include: None,
|
|
},
|
|
);
|
|
|
|
for platform in PLATFORMS {
|
|
let ref_ = client
|
|
.container_opts(QueryContainerOpts {
|
|
id: None,
|
|
platform: Some(platform.to_string().into()),
|
|
})
|
|
.from("alpine")
|
|
.export("./test")
|
|
.await?;
|
|
|
|
println!("published image to: {:#?}", ref_);
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn test_issue_30() -> eyre::Result<()> {
|
|
let client = dagger_sdk::connect().await?;
|
|
|
|
let context = client.host().directory_opts(
|
|
".",
|
|
HostDirectoryOpts {
|
|
exclude: Some(vec!["target", "client/node_modules", "client/build"]),
|
|
include: None,
|
|
},
|
|
);
|
|
|
|
for platform in PLATFORMS {
|
|
let ref_ = client
|
|
.container_opts(
|
|
QueryContainerOptsBuilder::default()
|
|
.platform(platform)
|
|
.build()
|
|
.unwrap(),
|
|
)
|
|
.from("alpine")
|
|
.export("./test")
|
|
.await?;
|
|
|
|
println!("published image to: {:#?}", ref_);
|
|
}
|
|
|
|
Ok(())
|
|
}
|