mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Differentiate build process for non-amd64 platforms
- reset `binfmt_misc` is needn't when the building platform is non-amd64 and the target arch is the same as building platform - non-amd64 platform doesn't supported cross-build well, and there is no binary of `qemu-user-static` able to do that, and thus skip the cross-build on non-amd64 platform. Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
eb2b71c727
commit
721da10205
@ -140,6 +140,11 @@ build() {
|
||||
${SED} -i "s|BASEARCH|${arch}|g" $dockerfile_name
|
||||
fi
|
||||
|
||||
# Only the cross-build on x86 is guaranteed by far, other arches like aarch64 doesn't support cross-build
|
||||
# thus, there is no need to tackle a disability feature on those platforms, and also help to prevent from
|
||||
# ending up a wrong image tag on non-amd64 platforms.
|
||||
build_arch=$(uname -m)
|
||||
if [[ ${build_arch} = "x86_64" ]]; then
|
||||
# copy the qemu-*-static binary to docker image to build the multi architecture image on x86 platform
|
||||
if grep -q "CROSS_BUILD_" Dockerfile; then
|
||||
if [[ "${arch}" == "amd64" ]]; then
|
||||
@ -159,6 +164,13 @@ build() {
|
||||
${SED} -i "s/CROSS_BUILD_//g" Dockerfile
|
||||
fi
|
||||
fi
|
||||
elif [[ "${QEMUARCHS[$arch]}" != "${build_arch}" ]]; then
|
||||
echo "skip cross-build $arch on non-supported platform ${build_arch}."
|
||||
popd
|
||||
continue
|
||||
else
|
||||
${SED} -i "/CROSS_BUILD_/d" Dockerfile
|
||||
fi
|
||||
|
||||
docker buildx build --progress=plain --no-cache --pull --output=type="${output_type}" --platform "${os_name}/${arch}" \
|
||||
--build-arg BASEIMAGE="${base_image}" --build-arg REGISTRY="${REGISTRY}" --build-arg OS_VERSION="${os_version}" \
|
||||
|
Loading…
Reference in New Issue
Block a user