Skip to content

Commit

Permalink
Dockerfile.aarch64/armhf update the crossbuild method
Browse files Browse the repository at this point in the history
  • Loading branch information
David Personette committed Sep 3, 2019
1 parent 5a4c03c commit df894f7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM balenalib/aarch64-alpine
FROM arm64v8/alpine
COPY qemu-aarch64-static /usr/bin/
MAINTAINER David Personette <[email protected]>

# 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 && \
Expand Down Expand Up @@ -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/

Expand Down
7 changes: 4 additions & 3 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM balenalib/armv7hf-alpine
FROM arm32v6/alpine
COPY qemu-arm-static /usr/bin/
MAINTAINER David Personette <[email protected]>

# 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 && \
Expand Down Expand Up @@ -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/

Expand Down
16 changes: 16 additions & 0 deletions hooks/post_checkout
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions hooks/pre_build
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit df894f7

Please sign in to comment.