Skip to content

Commit 885c0e3

Browse files
committed
Script: add --docker-platform in build_linux.sh
1 parent d7cc6ac commit 885c0e3

3 files changed

Lines changed: 25 additions & 6 deletions

File tree

.github/workflows/docker.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ jobs:
5151
lable: "13"
5252
os: ubuntu-24.04-arm
5353

54-
- PACKAGE: deb
55-
image: linuxdeepin/beige
56-
lable: "latest"
57-
os: ubuntu-24.04
5854
# - PACKAGE: deb
5955
# image: linuxdeepin/beige
6056
# lable: "latest"
57+
# os: ubuntu-24.04
58+
# - PACKAGE: deb
59+
# image: linuxdeepin/beige
60+
# platform: linux/arm64
61+
# lable: "latest"
6162
# os: ubuntu-24.04-arm
6263

6364
- PACKAGE: appimage
@@ -151,7 +152,7 @@ jobs:
151152
else
152153
docker_image="${{matrix.variant.image}}"
153154
fi
154-
./Script/build_linux.sh --docker --docker-image="${docker_image}" --${{matrix.variant.PACKAGE}}
155+
./Script/build_linux.sh --docker --docker-image="${docker_image}" --docker-platform="${{matrix.variant.platform}}" --${{matrix.variant.PACKAGE}}
155156
156157
- name: Rename deb file
157158
if: ${{ matrix.variant.PACKAGE == 'deb' }}

Script/build_linux.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Directory options:
4848
Docker options:
4949
--docker: Run docket for build
5050
--docker-image: The name of docker image
51+
--docker-platform The docker image platform
5152
5253
Target options:
5354
--deb: Build deb package
@@ -80,7 +81,7 @@ parse_with_getopt() {
8081
# 后面没有冒号表示没有参数。后跟有一个冒号表示有参数。跟两个冒号表示有可选参数。
8182
# -l 或 --long 选项后面是可接受的长选项,用逗号分开,冒号的意义同短选项。
8283
# -n 选项后接选项解析错误时提示的脚本名字
83-
OPTS=help,verbose::,docker::,deb::,rpm::,appimage::,macos::,docker-image:,qt:,install:,source:,tools:,build:
84+
OPTS=help,verbose::,docker::,deb::,rpm::,appimage::,macos::,docker-image:,docker-platform::,qt:,install:,source:,tools:,build:
8485
ARGS=`getopt -o h,v:: -l $OPTS -n $(basename $0) -- "$@"`
8586
if [ $? != 0 ]; then
8687
log_fail "exec getopt fail: $?"
@@ -138,6 +139,16 @@ parse_with_getopt() {
138139
esac
139140
shift 2
140141
;;
142+
--docker-platform)
143+
case $2 in
144+
"")
145+
;;
146+
*)
147+
DOCKER_PLATFORM=$2
148+
DOCKER=1;;
149+
esac
150+
shift 2
151+
;;
141152
--deb)
142153
case $2 in
143154
"")
@@ -351,6 +362,10 @@ if [ $DOCKER -eq 1 ]; then
351362
if [[ "$DOCKER_IMAGE" =~ ^(ubuntu|debian) ]]; then
352363
DOCKER_PARA="-e DEBIAN_FRONTEND=noninteractive -e TZ=UTC"
353364
fi
365+
echo "DOCKER_PLATFORM: $DOCKER_PLATFORM"
366+
if [ -n "$DOCKER_PLATFORM" ]; then
367+
DOCKER_PARA="$DOCKER_PARA --platform $DOCKER_PLATFORM"
368+
fi
354369
docker run --privileged ${DOCKER_PARA} \
355370
-e CI=${CI} \
356371
--volume ${REPO_ROOT}:/home/RabbitRemoteControl \

Script/common.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ get_package_tool() {
204204
ubuntu|debian|kali)
205205
echo "apt"
206206
;;
207+
deepin)
208+
echo "apt-get"
209+
;;
207210
fedora|rhel|centos|almalinux|rocky)
208211
if command -v dnf >/dev/null 2>&1; then
209212
echo "dnf"

0 commit comments

Comments
 (0)