mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-06-20 08:32:12 +08:00
multi-arch 的镜像使用使用支持 arm64
This commit is contained in:
4
Makefile
4
Makefile
@@ -232,7 +232,7 @@ docker-centos-build-stop:
|
||||
.PHONY: docker-centos-build
|
||||
.PHONY: docker-centos-build-stop
|
||||
|
||||
DOCKER_ALPINE_BUILD_IMAGE?=registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-3
|
||||
DOCKER_ALPINE_BUILD_IMAGE?=registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-5
|
||||
|
||||
define dockerAlpineBuildCmd
|
||||
set -o xtrace
|
||||
@@ -313,7 +313,7 @@ REGISTRY ?= "registry.cn-beijing.aliyuncs.com/yunionio"
|
||||
VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
|
||||
git describe --match=$(git rev-parse --short=8 HEAD) --always --dirty --abbrev=8)
|
||||
|
||||
image:
|
||||
image: clean
|
||||
DEBUG=$(DEBUG) ARCH=$(ARCH) TAG=$(VERSION) REGISTRY=$(REGISTRY) $(ROOT_DIR)/scripts/docker_push.sh $(filter-out $@,$(MAKECMDGOALS))
|
||||
|
||||
.PHONY: image
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-4-arm64 as build
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-5 as build
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILDPLATFORM
|
||||
RUN mkdir -p /root/go/src/yunion.io/x/onecloud
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-4-arm64 as build
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-5 as build
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILDPLATFORM
|
||||
RUN mkdir -p /root/go/src/yunion.io/x/onecloud
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-4-arm64 as build
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-5 as build
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILDPLATFORM
|
||||
RUN mkdir -p /root/go/src/yunion.io/x/onecloud
|
||||
|
||||
@@ -39,10 +39,10 @@ TAG=${TAG:-latest}
|
||||
|
||||
build_bin() {
|
||||
local BUILD_ARCH=$2
|
||||
local BUILD_CC=$3
|
||||
local BUILD_CGO=$4
|
||||
local BUILD_CGO=$3
|
||||
case "$1" in
|
||||
baremetal-agent)
|
||||
echo GOOS=linux make cmd/$1
|
||||
GOOS=linux make cmd/$1
|
||||
;;
|
||||
climc)
|
||||
@@ -50,16 +50,16 @@ build_bin() {
|
||||
-v $SRC_DIR:/root/go/src/yunion.io/x/onecloud \
|
||||
-v $SRC_DIR/_output/alpine-build:/root/go/src/yunion.io/x/onecloud/_output \
|
||||
-v $SRC_DIR/_output/alpine-build/_cache:/root/.cache \
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-3 \
|
||||
/bin/sh -c "set -ex; cd /root/go/src/yunion.io/x/onecloud; $BUILD_ARCH $BUILD_CC $BUILD_CGO GOOS=linux make cmd/$1 cmd/*cli; chown -R $(id -u):$(id -g) _output"
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-5 \
|
||||
/bin/sh -c "set -ex; cd /root/go/src/yunion.io/x/onecloud; $BUILD_ARCH $BUILD_CGO GOOS=linux make cmd/$1 cmd/*cli; chown -R $(id -u):$(id -g) _output"
|
||||
;;
|
||||
*)
|
||||
docker run --rm \
|
||||
-v $SRC_DIR:/root/go/src/yunion.io/x/onecloud \
|
||||
-v $SRC_DIR/_output/alpine-build:/root/go/src/yunion.io/x/onecloud/_output \
|
||||
-v $SRC_DIR/_output/alpine-build/_cache:/root/.cache \
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-3 \
|
||||
/bin/sh -c "set -ex; cd /root/go/src/yunion.io/x/onecloud; $BUILD_ARCH $BUILD_CC $BUILD_CGO GOOS=linux make cmd/$1; chown -R $(id -u):$(id -g) _output"
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-5 \
|
||||
/bin/sh -c "set -ex; cd /root/go/src/yunion.io/x/onecloud; $BUILD_ARCH $BUILD_CGO GOOS=linux make cmd/$1; chown -R $(id -u):$(id -g) _output"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -112,7 +112,7 @@ build_process_with_buildx() {
|
||||
img_name="$REGISTRY/$component:$TAG"
|
||||
if [[ "$arch" == arm64 ]]; then
|
||||
img_name="$img_name-$arch"
|
||||
build_env="$build_env CC=aarch64-linux-musl-gcc"
|
||||
build_env="$build_env"
|
||||
if [[ $component == host ]]; then
|
||||
build_env="$build_env CGO_ENABLED=1"
|
||||
fi
|
||||
@@ -161,7 +161,7 @@ for component in $COMPONENTS; do
|
||||
build_process_with_buildx $component $arch
|
||||
done
|
||||
;;
|
||||
arm64|amd64)
|
||||
arm64 )
|
||||
build_process_with_buildx $component $ARCH
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user