From c92844bd0ed19747d0f06701475adbf73a3ab0e1 Mon Sep 17 00:00:00 2001 From: Bastien Wirtz Date: Tue, 19 May 2020 20:41:05 -0700 Subject: Fix multiarch docker build. --- Dockerfile.arm32v7 | 1 + Dockerfile.arm64v8 | 1 + hooks/post_push | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 index 79a7a61..58a1834 100644 --- a/Dockerfile.arm32v7 +++ b/Dockerfile.arm32v7 @@ -1,4 +1,5 @@ FROM arm32v7/alpine:3.11 +COPY qemu-arm-static /usr/bin COPY ./ /www/ diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 index 707dd83..69132a3 100644 --- a/Dockerfile.arm64v8 +++ b/Dockerfile.arm64v8 @@ -1,4 +1,5 @@ FROM arm64v8/alpine:3.11 +COPY qemu-arm-static /usr/bin COPY ./ /www/ diff --git a/hooks/post_push b/hooks/post_push index d721b68..08384f3 100644 --- a/hooks/post_push +++ b/hooks/post_push @@ -1,5 +1,10 @@ #!/bin/bash +#!/bin/bash +# downloads a local copy of qemu on docker-hub build machines +curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static . + + docker manifest push --purge b4bz/homer:latest docker manifest create b4bz/homer:latest b4bz/homer:latest-amd64 b4bz/homer:latest-arm32v7 b4bz/homer:latest-arm64v8 docker manifest annotate b4bz/homer:latest b4bz/homer:latest-arm32v7 --os linux --arch arm -- cgit v1.2.3 From 5a5412c5d12d535b41084a7e1971922af156ae7c Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Wed, 20 May 2020 15:31:02 +1000 Subject: Fixing multi-arch container builds --- Dockerfile.arm32v7 | 11 +++++++++-- Dockerfile.arm64v8 | 11 +++++++++-- hooks/post_push | 5 ----- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 index 58a1834..12322d4 100644 --- a/Dockerfile.arm32v7 +++ b/Dockerfile.arm32v7 @@ -1,6 +1,12 @@ +FROM alpine as qemu + +ARG QEMU_VERSION "v4.2.0-7" + +RUN wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-arm-static && chmod +x qemu-arm-static + FROM arm32v7/alpine:3.11 -COPY qemu-arm-static /usr/bin +COPY --from=qemu qemu-arm-static /usr/bin/ COPY ./ /www/ ENV USER darkhttpd @@ -9,7 +15,8 @@ ENV GID 911 ENV UID 911 RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \ - apk add -U darkhttpd + apk add -U darkhttpd && \ + rm /usr/bin/qemu-arm-static USER darkhttpd diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 index 69132a3..490a109 100644 --- a/Dockerfile.arm64v8 +++ b/Dockerfile.arm64v8 @@ -1,6 +1,12 @@ +FROM alpine as qemu + +ARG QEMU_VERSION "v4.2.0-7" + +RUN wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_VERSION}/qemu-aarch64-static && chmod +x qemu-aarch64-static + FROM arm64v8/alpine:3.11 -COPY qemu-arm-static /usr/bin +COPY --from=qemu qemu-aarch64-static /usr/bin/ COPY ./ /www/ ENV USER darkhttpd @@ -9,7 +15,8 @@ ENV GID 911 ENV UID 911 RUN addgroup -S ${GROUP} -g ${GID} && adduser -D -S -u ${UID} ${USER} ${GROUP} && \ - apk add -U darkhttpd + apk add -U darkhttpd && \ + rm /usr/bin/qemu-aarch64-static USER darkhttpd diff --git a/hooks/post_push b/hooks/post_push index 08384f3..d721b68 100644 --- a/hooks/post_push +++ b/hooks/post_push @@ -1,10 +1,5 @@ #!/bin/bash -#!/bin/bash -# downloads a local copy of qemu on docker-hub build machines -curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static . - - docker manifest push --purge b4bz/homer:latest docker manifest create b4bz/homer:latest b4bz/homer:latest-amd64 b4bz/homer:latest-arm32v7 b4bz/homer:latest-arm64v8 docker manifest annotate b4bz/homer:latest b4bz/homer:latest-arm32v7 --os linux --arch arm -- cgit v1.2.3