mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
docker 交叉编译规则更新
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user