From e1a4bf32a6b56462c5f44fa44ac8a81a457a9496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bondis?= Date: Fri, 23 Aug 2019 15:24:21 -0400 Subject: [PATCH] only insert qemu binary if building for arm --- core/admin/Dockerfile | 7 ++++--- tests/build_arm.sh | 6 ++++-- webmails/rainloop/Dockerfile | 12 ++++++++++-- webmails/roundcube/Dockerfile | 9 +++++++-- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/core/admin/Dockerfile b/core/admin/Dockerfile index ee719b27..a3aff3d4 100644 --- a/core/admin/Dockerfile +++ b/core/admin/Dockerfile @@ -1,5 +1,7 @@ # First stage to build assets -FROM node:8 as assets +ARG ARCH="" +FROM ${ARCH}node:8 as assets +COPY --from=balenalib/rpi-alpine:3.10 /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static COPY package.json ./ RUN npm install @@ -41,5 +43,4 @@ ENV FLASK_APP mailu CMD /start.py -HEALTHCHECK CMD curl -f -L http://localhost/ui/login?next=ui.index || exit 1 - +HEALTHCHECK CMD curl -f -L http://localhost/ui/login?next=ui.index || exit 1 \ No newline at end of file diff --git a/tests/build_arm.sh b/tests/build_arm.sh index bf65c697..04836ddb 100755 --- a/tests/build_arm.sh +++ b/tests/build_arm.sh @@ -3,11 +3,13 @@ ALPINE_VER="3.10" DISTRO="balenalib/rpi-alpine:$ALPINE_VER" # Used for webmails -PHP="arm32v7/php:7.3-apache" +QEMU="arm" +ARCH="arm32v7/" # use qemu-*-static from docker container docker run --rm --privileged multiarch/qemu-user-static:register docker-compose -f build.yml build \ --build-arg DISTRO=$DISTRO \ - --build-arg PHP_DISTRO=$PHP \ + --build-arg ARCH=$ARCH \ + --build-arg QEMU=$QEMU \ --parallel $@ diff --git a/webmails/rainloop/Dockerfile b/webmails/rainloop/Dockerfile index 99aa9fde..05f8fa2d 100644 --- a/webmails/rainloop/Dockerfile +++ b/webmails/rainloop/Dockerfile @@ -1,5 +1,13 @@ -ARG PHP_DISTRO=php:7.3-apache -FROM $PHP_DISTRO +ARG ARCH="" +ARG QEMU=other + +# NOTE: only add file if building for arm +FROM ${ARCH}php:7.3-apache as build_arm +ONBUILD COPY --from=balenalib/rpi-alpine:3.10 /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static + +FROM ${ARCH}php:7.3-apache as build_other + +FROM build_${QEMU} #Shared layer between rainloop and roundcube RUN apt-get update && apt-get install -y \ python3 curl python3-pip git \ diff --git a/webmails/roundcube/Dockerfile b/webmails/roundcube/Dockerfile index e094e8f9..9a526617 100644 --- a/webmails/roundcube/Dockerfile +++ b/webmails/roundcube/Dockerfile @@ -1,5 +1,10 @@ -ARG PHP_DISTRO=php:7.3-apache -FROM PHP_DISTRO +# NOTE: only add file if building for arm +FROM ${ARCH}php:7.3-apache as build_arm +ONBUILD COPY --from=balenalib/rpi-alpine:3.10 /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static + +FROM ${ARCH}php:7.3-apache as build_other + +FROM build_${QEMU} #Shared layer between rainloop and roundcube RUN apt-get update && apt-get install -y \ python3 curl python3-pip git \