Skip to content
Snippets Groups Projects
Unverified Commit ad845905 authored by yunion-ci-robot's avatar yunion-ci-robot Committed by GitHub
Browse files

Merge pull request #8855 from zhasm/automated-cherry-pick-of-#8849-upstream-release-3.4

Automated cherry pick of #8849: docker 交叉编译规则更新
parents 4b4964e5 491a9ece
No related branches found
No related tags found
No related merge requests found
......@@ -100,6 +100,11 @@ build_process() {
build_bin $component
build_bundle_libraries $component
img_name="$REGISTRY/$component:$TAG"
if [[ "$(uname -m)" == aarch64 ]]; then
img_name="${img_name}-arm64"
fi
build_image $img_name $DOCKER_DIR/Dockerfile.$component $SRC_DIR
push_image "$img_name"
}
......@@ -129,6 +134,28 @@ build_process_with_buildx() {
esac
}
function general_build(){
local current_arch
case $(uname -m) in
x86_64)
current_arch=amd64
;;
aarch64)
current_arch=arm64
;;
esac
local component=$1
# 如果未指定,则默认使用当前架构
local arch=${2:-$current_arch}
if [[ "$current_arch" == "$arch" ]]; then
build_process $component
else
build_process_with_buildx $component $arch
fi
}
ALL_COMPONENTS=$(ls cmd | grep -v '.*cli$' | xargs)
if [ "$#" -lt 1 ]; then
......@@ -160,14 +187,11 @@ for component in $COMPONENTS; do
case "$ARCH" in
all)
for arch in "arm64" "amd64"; do
build_process_with_buildx $component $arch
general_build $component $arch
done
;;
arm64|amd64)
build_process_with_buildx $component $ARCH
;;
*)
build_process $component
general_build $component $ARCH
;;
esac
done
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment