fix(docker buildx cross platform docker image fix): 跨平台编译docker镜像明确指定架构

This commit is contained in:
Zhang Dongliang
2023-09-05 12:43:26 +08:00
parent 7fcd93637d
commit 10c0957f6f
+7 -1
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
}