Skip to content

xtask/build_docker_image: Add windows/amd64 platform handling #1672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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