diff --git a/scripts/docker_push.sh b/scripts/docker_push.sh index 3c700e24a7..99f5a2fd52 100755 --- a/scripts/docker_push.sh +++ b/scripts/docker_push.sh @@ -103,6 +103,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" } @@ -132,6 +137,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 @@ -163,14 +190,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