mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
@@ -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(),
|
||||
}
|
||||
|
||||
@@ -122,7 +122,8 @@ impl<'a> std::ops::DerefMut for ExtendedCommand<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Invoke<'a> for tokio::process::Command {
|
||||
type Extended<'ext> = ExtendedCommand<'ext>
|
||||
type Extended<'ext>
|
||||
= ExtendedCommand<'ext>
|
||||
where
|
||||
Self: 'ext,
|
||||
'ext: 'a;
|
||||
@@ -162,7 +163,8 @@ impl<'a> Invoke<'a> for tokio::process::Command {
|
||||
}
|
||||
|
||||
impl<'a> Invoke<'a> for ExtendedCommand<'a> {
|
||||
type Extended<'ext> = &'ext mut ExtendedCommand<'ext>
|
||||
type Extended<'ext>
|
||||
= &'ext mut ExtendedCommand<'ext>
|
||||
where
|
||||
Self: 'ext,
|
||||
'ext: 'a;
|
||||
@@ -663,8 +665,8 @@ impl FromStr for PathOrUrl {
|
||||
type Err = <PathBuf as FromStr>::Err;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
if let Ok(url) = s.parse::<Url>() {
|
||||
if url.scheme() == "file" {
|
||||
Ok(Self::Path(url.path().parse()?))
|
||||
if let Some(path) = s.strip_prefix("file://") {
|
||||
Ok(Self::Path(path.parse()?))
|
||||
} else {
|
||||
Ok(Self::Url(url))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user