Adding QEMU static arm binary to build ARM images

This commit is contained in:
Quentin McGaw
2019-04-26 16:02:14 +02:00
parent cc36ba5207
commit 99f48b964b
4 changed files with 31 additions and 3 deletions

View File

@@ -9,17 +9,20 @@ env:
- DOCKER_BUILD=qmcgaw/private-internet-access
- MICROBADGER_CODE=tQFy7AxtSUNANPe6aoVChYdsI_I=
matrix:
- TARGET_IMAGE=${DOCKER_BUILD}
- ARCH=armhf
BASE_IMAGE=arm32v6/alpine
TARGET_IMAGE=${DOCKER_BUILD}:${ARCH}
QEMU=https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-3/qemu-arm-static
- ARCH=aarch64
BASE_IMAGE=arm64v8/alpine
TARGET_IMAGE=${DOCKER_BUILD}:${ARCH}
QEMU=https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-3/qemu-arm-static
script:
- set -e
- echo "$DOCKER_PASSWORD" | docker login -u qmcgaw --password-stdin
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
- docker build -t ${TARGET_IMAGE} --build-arg BASE_IMAGE=${BASE_IMAGE} --build-arg VCF=${TRAVIS_COMMIT} --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" .
- docker build -t ${TARGET_IMAGE} --build-arg BASE_IMAGE=${BASE_IMAGE} --build-arg QEMU=${QEMU} --build-arg VCF=${TRAVIS_COMMIT} --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" .
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && docker push ${DOCKER_BUILD} || false'
- "curl -X POST https://hooks.microbadger.com/images/${DOCKER_BUILD}/${MICROBADGER_CODE}"

0
.void Normal file
View File

View File

@@ -1,8 +1,11 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE:-alpine}:3.9
ARG QEMU=
ARG BUILD_DATE
ARG VCS_REF
# Only installed for ARM devices
ADD .void ${QEMU}? /usr/bin/
LABEL org.label-schema.schema-version="1.0.0-rc1" \
maintainer="quentin.mcgaw@gmail.com" \
org.label-schema.build-date=$BUILD_DATE \
@@ -64,4 +67,5 @@ RUN chown nonrootuser -R /etc/unbound && \
/etc/unbound/root.hints \
/etc/unbound/root.key \
/etc/unbound/unbound.conf \
/etc/unbound/*.bz2
/etc/unbound/*.bz2 && \
rm -f /usr/bin/qemu-arm-static /usr/bin/.void

View File

@@ -75,7 +75,7 @@
modprobe tun
```
1. **IF YOU HAVE AN ARM DEVICE, depending on your cpu architecture:** replace `qmcgaw/private-internet-access`
1. **ONLY IF YOU HAVE AN ARM DEVICE, depending on your cpu architecture,** replace `qmcgaw/private-internet-access`
with either `qmcgaw/private-internet-access:armhf` (32 bit) or `qmcgaw/private-internet-access:aarch64` (64 bit).
1. Launch the container with:
@@ -246,6 +246,27 @@ services:
# add more volumes etc.
```
## ARM devices
If you want to save 3-5MB on the image (because of QEMU), use the following command on
your ARM device:
- If your architecture is ARMHF (32 bit)
```sh
docker build -t qmcgaw/private-internet-access:armhf \
--build-arg BASE_IMAGE=arm32v6/alpine \
https://github.com/qdm12/private-internet-access-docker.git
```
- If your architecture is AARCH64 (64 bit)
```sh
docker build -t qmcgaw/private-internet-access:aarch64 \
--build-arg BASE_IMAGE=arm64v8/alpine \
https://github.com/qdm12/private-internet-access-docker.git
```
## For the paranoids
- You can review the code which essential consits in the [Dockerfile](https://github.com/qdm12/private-internet-access-docker/blob/master/Dockerfile) and [entrypoint.sh](https://github.com/qdm12/private-internet-access-docker/blob/master/entrypoint.sh)