From d394b957d13d978a0eee4ff4a0c2bfe275fdb4f9 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 8 Nov 2023 16:50:08 -0600 Subject: [PATCH] Use piwheels for armv7 docker image builds (#5703) --- docker/Dockerfile | 7 ++++--- docker/build.py | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 72aa9d9a9c..262827dea4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,6 +14,7 @@ FROM base-${BASEIMGTYPE} AS base ARG TARGETARCH ARG TARGETVARIANT +ARG PIP_EXTRA_INDEX_URL # Note that --break-system-packages is used below because # https://peps.python.org/pep-0668/ added a safety check that prevents @@ -46,7 +47,7 @@ RUN \ libssl-dev=3.0.11-1~deb12u2 \ libffi-dev=3.4.4-1 \ cargo=0.66.0+ds1-1 \ - pkg-config=1.8.1-1; \ + pkg-config=1.8.1-1 \ gcc-arm-linux-gnueabihf=4:12.2.0-3; \ fi; \ rm -rf \ @@ -58,8 +59,8 @@ ENV \ # Fix click python3 lang warning https://click.palletsprojects.com/en/7.x/python3/ LANG=C.UTF-8 LC_ALL=C.UTF-8 \ # Store globally installed pio libs in /piolibs - PLATFORMIO_GLOBALLIB_DIR=/piolibs - + PLATFORMIO_GLOBALLIB_DIR=/piolibs \ + PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL} # Support legacy binaries on Debian multiarch system. There is no "correct" way # to do this, other than using properly built toolchains... diff --git a/docker/build.py b/docker/build.py index 47461ddf97..ae0f5088d8 100755 --- a/docker/build.py +++ b/docker/build.py @@ -143,15 +143,25 @@ def main(): imgs = [f"{params.build_to}:{tag}" for tag in tags_to_push] imgs += [f"ghcr.io/{params.build_to}:{tag}" for tag in tags_to_push] + build_args = [ + "--build-arg", + f"BASEIMGTYPE={params.baseimgtype}", + "--build-arg", + f"BUILD_VERSION={args.tag}", + ] + + if args.arch == ARCH_ARMV7: + build_args += [ + "--build-arg", + "PIP_EXTRA_INDEX_URL=https://www.piwheels.org/simple", + ] + # 3. build cmd = [ "docker", "buildx", "build", - "--build-arg", - f"BASEIMGTYPE={params.baseimgtype}", - "--build-arg", - f"BUILD_VERSION={args.tag}", + *build_args, "--cache-from", f"type=registry,ref={cache_img}", "--file",