Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/docker/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ impl ImagePlatform {
ImagePlatform::from_const_target(TargetTriple::X86_64UnknownLinuxGnu);
pub const AARCH64_UNKNOWN_LINUX_GNU: Self =
ImagePlatform::from_const_target(TargetTriple::Aarch64UnknownLinuxGnu);
pub const X86_64_PC_WINDOWS_MSVC: Self =
ImagePlatform::from_const_target(TargetTriple::X86_64PcWindowsMsvc);

/// Get a representative version of this platform specifier for usage in `--platform`
///
Expand All @@ -199,6 +201,7 @@ impl ImagePlatform {
TargetTriple::Aarch64UnknownLinuxGnu => {
Some("ImagePlatform::AARCH64_UNKNOWN_LINUX_GNU")
}
TargetTriple::X86_64PcWindowsMsvc => Some("ImagePlatform::X86_64_PC_WINDOWS_MSVC"),
_ => None,
}
}
Expand Down Expand Up @@ -237,6 +240,7 @@ impl std::str::FromStr for ImagePlatform {
match s {
"linux/amd64" => return Ok(Self::X86_64_UNKNOWN_LINUX_GNU),
"linux/arm64" | "linux/arm64/v8" => return Ok(Self::AARCH64_UNKNOWN_LINUX_GNU),
"windows/amd64" => return Ok(Self::X86_64_PC_WINDOWS_MSVC),
_ => {}
};

Expand Down Expand Up @@ -542,6 +546,11 @@ pub mod tests {
ImagePlatform::AARCH64_UNKNOWN_LINUX_GNU
);

assert_eq!(
"windows/amd64".parse::<ImagePlatform>()?,
ImagePlatform::X86_64_PC_WINDOWS_MSVC
);

Ok(())
}
}
Loading