Skip to content

Commit 01fd773

Browse files
committed
Switch to Docker --platform
1 parent c270728 commit 01fd773

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

ci/build-in-docker.sh

+11-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ error() {
1818
log_message 1 "[error] $*"
1919
}
2020

21-
if [[ "$ARCH" == "" ]]; then
21+
if [[ "${ARCH:-}" == "" ]]; then
2222
error "Usage: env ARCH=... bash $0"
2323
exit 2
2424
fi
@@ -29,16 +29,16 @@ this_dir="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"
2929

3030
case "$ARCH" in
3131
x86_64)
32-
docker_arch=amd64
32+
docker_platform=linux/amd64
3333
;;
3434
i386)
35-
docker_arch=i386
35+
docker_platform=linux/386
3636
;;
3737
armhf)
38-
docker_arch=arm32v7
38+
docker_platform=linux/arm/v7
3939
;;
4040
aarch64)
41-
docker_arch=arm64v8
41+
docker_platform=linux/arm64/v8
4242
;;
4343
*)
4444
echo "Unsupported \$ARCH: $ARCH"
@@ -49,7 +49,7 @@ esac
4949
# first, we need to build the image
5050
# we always attempt to build it, it will only be rebuilt if Docker detects changes
5151
# optionally, we'll pull the base image beforehand
52-
info "Building Docker image for $ARCH (Docker arch: $docker_arch)"
52+
info "Building Docker image for $ARCH (Docker platform: $docker_platform)"
5353

5454
build_args=()
5555
if [[ "${UPDATE:-}" == "" ]]; then
@@ -58,11 +58,11 @@ else
5858
build_args+=("--pull")
5959
fi
6060

61-
docker_image=linuxdeploy-plugin-qt-build:"$ARCH"
61+
docker_image=linuxdeploy-plugin-qt-build
6262

6363
docker build \
64+
--platform "$docker_platform" \
6465
--build-arg ARCH="$ARCH" \
65-
--build-arg docker_arch="$docker_arch" \
6666
"${build_args[@]}" \
6767
-t "$docker_image" \
6868
"$this_dir"/docker
@@ -104,11 +104,12 @@ run_in_docker() {
104104
# b) allow the build scripts to "mv" the binaries into the /out directory
105105
docker run \
106106
--rm \
107+
--platform "$docker_platform" \
107108
-i \
108109
--init \
110+
-e ARCH \
109111
-e GITHUB_RUN_NUMBER \
110112
-e USE_STATIC_RUNTIME \
111-
-e ARCH \
112113
-e CI \
113114
--user "$uid" \
114115
"${docker_args[@]}" \
@@ -119,7 +120,7 @@ run_in_docker() {
119120
}
120121

121122
filename_suffix=
122-
if [[ "$USE_STATIC_RUNTIME" != "" ]]; then
123+
if [[ "${USE_STATIC_RUNTIME:-}" != "" ]]; then
123124
filename_suffix="-static"
124125
fi
125126

ci/docker/Dockerfile

+1-7
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,12 @@
33
# needs to be re-run in CI every time as we cannot store auto-built Docker images due to GitHub's strict quota
44
# it will save a lot of time in local development environments, though
55

6-
ARG docker_arch
7-
86
# we'll just use Debian as a base image for now, mainly because it produces less headache than Ubuntu with arm
97
# a big pro is that they ship an up to date CMake in their stable distribution
108
# also, they still provide IA-32 builds for some reason...
119
# some people in the AppImage community do not (want to) realize i386 is dead for good
1210
# we are going to drop i686 in the future!
13-
FROM ${docker_arch}/debian:stable
14-
15-
# variables that need to be availabe during build and runtime must(!) be repeated after FROM
16-
ARG ARCH
17-
11+
FROM debian:stable
1812

1913
SHELL ["bash", "-x", "-c"]
2014

0 commit comments

Comments
 (0)