sdk tweaks (#2791)

* sdk tweaks

* switch back to deeppartial
This commit is contained in:
Aiden McClelland
2024-11-25 11:49:11 -07:00
committed by GitHub
parent e4a2af6ae7
commit 504f1a8e97
18 changed files with 149 additions and 106 deletions

View File

@@ -354,7 +354,9 @@ pub enum ImageSource {
Packed,
#[serde(rename_all = "camelCase")]
DockerBuild {
#[ts(optional)]
workdir: Option<PathBuf>,
#[ts(optional)]
dockerfile: Option<PathBuf>,
#[serde(skip_serializing_if = "Option::is_none")]
#[ts(optional)]
@@ -366,8 +368,15 @@ impl ImageSource {
pub fn ingredients(&self) -> Vec<PathBuf> {
match self {
Self::Packed => Vec::new(),
Self::DockerBuild { dockerfile, .. } => {
vec![dockerfile.clone().unwrap_or_else(|| "Dockerfile".into())]
Self::DockerBuild {
dockerfile,
workdir,
..
} => {
vec![workdir
.as_deref()
.unwrap_or(Path::new("."))
.join(dockerfile.as_deref().unwrap_or(Path::new("Dockerfile")))]
}
Self::DockerTag(_) => Vec::new(),
}