1use camino::Utf8PathBuf as PathBuf;
2use std::env;
3
4use crate::{build::build_target, Container, Result};
5
6pub fn build_and_deploy(
9 bin_name: &str,
10 projdir: Option<&str>,
11 features: Option<&str>,
12 image: &str,
13) -> Result<(Container, PathBuf)> {
14 let pwd = env::var("PWD")?;
15 let pd = if let Some(pd) = projdir {
16 format!("{pwd}/{pd}")
17 } else {
18 pwd
19 };
20
21 let bin_path = build_target(bin_name, &pd, features, image)?;
22
23 let container = Container::new()?;
24 let dest_bin = container.copy_binary(&bin_path)?;
25
26 Ok((container, dest_bin))
27}