From df894f716b9128cd3dee3d38fd639c201e9b75ba Mon Sep 17 00:00:00 2001 From: David Personette Date: Tue, 3 Sep 2019 08:46:45 -0400 Subject: [PATCH] Dockerfile.aarch64/armhf update the crossbuild method --- Dockerfile.aarch64 | 7 ++++--- Dockerfile.armhf | 7 ++++--- hooks/post_checkout | 16 ++++++++++++++++ hooks/pre_build | 8 ++++++++ 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 hooks/post_checkout create mode 100644 hooks/pre_build diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index ba11e1c..fba6655 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,8 +1,8 @@ -FROM balenalib/aarch64-alpine +FROM arm64v8/alpine +COPY qemu-aarch64-static /usr/bin/ MAINTAINER David Personette # Install samba -RUN ["cross-build-start"] RUN apk --no-cache --no-progress upgrade && \ apk --no-cache --no-progress add bash samba shadow tini && \ addgroup -S smb && \ @@ -57,9 +57,10 @@ RUN apk --no-cache --no-progress upgrade && \ echo ' fruit:advertise_fullsync = true' >>$file && \ echo ' fruit:time machine = yes' >>$file && \ echo ' smb2 leases = yes' >>$file && \ + echo ' aio read size = 0' >>$file && \ + echo ' aio write size = 0' >>$file && \ echo '' >>$file && \ rm -rf /tmp/* -RUN ["cross-build-end"] COPY samba.sh /usr/bin/ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index c896691..c2e0ef6 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,8 +1,8 @@ -FROM balenalib/armv7hf-alpine +FROM arm32v6/alpine +COPY qemu-arm-static /usr/bin/ MAINTAINER David Personette # Install samba -RUN ["cross-build-start"] RUN apk --no-cache --no-progress upgrade && \ apk --no-cache --no-progress add bash samba shadow tini && \ addgroup -S smb && \ @@ -57,9 +57,10 @@ RUN apk --no-cache --no-progress upgrade && \ echo ' fruit:advertise_fullsync = true' >>$file && \ echo ' fruit:time machine = yes' >>$file && \ echo ' smb2 leases = yes' >>$file && \ + echo ' aio read size = 0' >>$file && \ + echo ' aio write size = 0' >>$file && \ echo '' >>$file && \ rm -rf /tmp/* -RUN ["cross-build-end"] COPY samba.sh /usr/bin/ diff --git a/hooks/post_checkout b/hooks/post_checkout new file mode 100644 index 0000000..880ef72 --- /dev/null +++ b/hooks/post_checkout @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d '.' -f2) + +[ "${BUILD_ARCH}" == "Dockerfile" ] && \ + { echo 'qemu-user-static: Download not required for this arch'; exit 0; } + +TAGS_API="https://api.github.com/repos/multiarch/qemu-user-static/tags" +URL="https://github.com/multiarch/qemu-user-static/releases/download" +LATEST_TAG=$(curl -LSs $TAGS_API \ + | awk -F'"' '/name.*v[0-9]/ {print $4; exit}') +STATIC_ARCH=$([ "${BUILD_ARCH}" == "armhf" ] && \ + echo "${BUILD_ARCH::-2}" || echo "${BUILD_ARCH}") + +curl -LSs "${URL}/${LATEST_TAG}/x86_64_qemu-${STATIC_ARCH}-static.tar.gz" \ + | tar xzv diff --git a/hooks/pre_build b/hooks/pre_build new file mode 100644 index 0000000..98648f2 --- /dev/null +++ b/hooks/pre_build @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d '.' -f2) + +[ "${BUILD_ARCH}" == "Dockerfile" ] && \ + { echo 'qemu-user-static: Registration not required for this arch';exit 0; } + +docker run --rm --privileged multiarch/qemu-user-static:register --reset