Merge pull request #17929 from zhasm/automated-cherry-pick-of-#17927-upstream-release-3.9

Automated cherry pick of #17927: fix(docker buildx cross platform docker image fix): 跨平台编译docker镜像明确指定架构
This commit is contained in:
Zexi Li
2023-09-05 12:49:48 +08:00
committed by GitHub

View File

@@ -117,7 +117,13 @@ build_image() {
;;
esac
else
docker buildx build -t "$tag" -f "$2" "$3" --push
if [[ "$tag" == *"amd64" || "$ARCH" == "" || "$ARCH" == "amd64" || "$ARCH" == "x86_64" || "$ARCH" == "x86" ]]; then
docker buildx build -t "$tag" -f "$file" "$path" --push --platform linux/amd64
elif [[ "$tag" == *"arm64" || "$ARCH" == "arm64" ]]; then
docker buildx build -t "$tag" -f "$file" "$path" --push --platform linux/amd64
else
docker buildx build -t "$tag" -f "$file" "$path" --push
fi
docker pull "$tag"
fi
}