Skip to content

Commit 7413658

Browse files
authored
Merge pull request #1684 from ioito/hotfix/qx-risc-v-docker
fix: support risc-v
2 parents 988b917 + 0eefeb3 commit 7413658

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

build/docker/Dockerfile.cloudmux

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.3.5
1+
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v3.22.2-0
22

3-
ENV TZ Asia/Shanghai
3+
ENV TZ="Asia/Shanghai"
44

55
RUN mkdir -p /opt/yunion/bin
66
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

scripts/docker_push.sh

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ get_current_arch() {
3434
aarch64)
3535
current_arch=arm64
3636
;;
37+
riscv64)
38+
current_arch=riscv64
39+
;;
3740
esac
3841
echo $current_arch
3942
}
@@ -66,15 +69,15 @@ build_bin() {
6669
-v $SRC_DIR:/root/go/src/yunion.io/x/$PKGNAME \
6770
-v $SRC_DIR/_output/alpine-build:/root/go/src/yunion.io/x/$PKGNAME/_output \
6871
-v $SRC_DIR/_output/alpine-build/_cache:/root/.cache \
69-
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.22.0-go-1.24.6-0 \
72+
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.22.2-go-1.24.9-0 \
7073
/bin/sh -c "set -ex; git config --global --add safe.directory /root/go/src/yunion.io/x/$PKGNAME; cd /root/go/src/yunion.io/x/$PKGNAME; $BUILD_ARCH $BUILD_CGO GOOS=linux make cmd/*cli; chown -R $(id -u):$(id -g) _output"
7174
;;
7275
*)
7376
docker run --rm \
7477
-v $SRC_DIR:/root/go/src/yunion.io/x/$PKGNAME \
7578
-v $SRC_DIR/_output/alpine-build:/root/go/src/yunion.io/x/$PKGNAME/_output \
7679
-v $SRC_DIR/_output/alpine-build/_cache:/root/.cache \
77-
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.22.0-go-1.24.6-0 \
80+
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.22.2-go-1.24.9-0 \
7881
/bin/sh -c "set -ex; git config --global --add safe.directory /root/go/src/yunion.io/x/$PKGNAME; cd /root/go/src/yunion.io/x/$PKGNAME; $BUILD_ARCH $BUILD_CGO GOOS=linux make cmd/$1; chown -R $(id -u):$(id -g) _output"
7982
;;
8083
esac
@@ -108,7 +111,7 @@ get_image_name() {
108111
local is_all_arch=$3
109112

110113
local img_name="$REGISTRY/$component:$TAG"
111-
if [[ "$is_all_arch" == "true" || "$arch" == arm64 ]]; then
114+
if [[ "$is_all_arch" == "true" || "$arch" == arm64 || "$arch" == riscv64 ]]; then
112115
img_name="${img_name}-$arch"
113116
fi
114117
echo $img_name
@@ -137,23 +140,16 @@ build_process_with_buildx() {
137140
local img_name=$(get_image_name $component $arch $is_all_arch)
138141

139142
build_env="GOARCH=$arch"
140-
if [[ "$arch" == arm64 ]]; then
143+
if [[ "$arch" == arm64 || "$arch" == riscv64 ]]; then
141144
build_env="$build_env"
142145
fi
143146
if [[ "$DRY_RUN" == "true" ]]; then
144147
build_bin $component $build_env
145148
echo "[$(readlink -f ${BASH_SOURCE}):${LINENO} ${FUNCNAME[0]}] return for DRY_RUN"
146149
return
147150
fi
148-
case "$component" in
149-
host | torrent)
150-
buildx_and_push $img_name $DOCKER_DIR/multi-arch/Dockerfile.$component $SRC_DIR $arch
151-
;;
152-
*)
153-
build_bin $component $build_env
154-
buildx_and_push $img_name $DOCKER_DIR/Dockerfile.$component $SRC_DIR $arch
155-
;;
156-
esac
151+
build_bin $component $build_env
152+
buildx_and_push $img_name $DOCKER_DIR/Dockerfile.$component $SRC_DIR $arch
157153
}
158154

159155
general_build() {
@@ -178,7 +174,8 @@ make_manifest_image() {
178174
fi
179175
docker buildx imagetools create -t $img_name \
180176
$img_name-amd64 \
181-
$img_name-arm64
177+
$img_name-arm64 \
178+
$img_name-riscv64
182179
}
183180

184181
ALL_COMPONENTS=$(ls cmd | grep -v '.*cli$' | xargs)
@@ -204,17 +201,11 @@ for component in $COMPONENTS; do
204201
continue
205202
fi
206203
echo "Start to build component: $component"
207-
if [[ $component == baremetal-agent ]]; then
208-
if [[ "$ARCH" == "arm64" ]]; then
209-
continue
210-
fi
211-
build_process $component
212-
continue
213-
fi
204+
build_process $component $ARCH "false"
214205

215206
case "$ARCH" in
216207
all)
217-
for arch in "arm64" "amd64"; do
208+
for arch in "arm64" "amd64" "riscv64"; do
218209
general_build $component $arch "true"
219210
done
220211
make_manifest_image $component

0 commit comments

Comments
 (0)