Merge #985
985: Permit raspberry pi (and other architectures) builds r=mergify[bot] a=abondis ## What type of PR? Enhancement ## What does this PR do? Add an option to select base images and permit building for different CPU architectures. ### Related issue(s) N/A ## Prerequistes - [X] documentation updated accordingly - [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file. Co-authored-by: Aurélien Bondis <aurelien.bondis@gmail.com> Co-authored-by: Aurelien <aurelien.bondis@gmail.com>master
commit
0417c791ff
@ -1,5 +1,6 @@
|
|||||||
# This is an idle image to dynamically replace any component if disabled.
|
# This is an idle image to dynamically replace any component if disabled.
|
||||||
|
|
||||||
FROM alpine:3.10
|
ARG DISTRO=alpine:3.10
|
||||||
|
FROM $DISTRO
|
||||||
|
|
||||||
CMD sleep 1000000d
|
CMD sleep 1000000d
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
.. _rpi_build:
|
||||||
|
|
||||||
|
Building for a Raspberry Pi
|
||||||
|
===========================
|
||||||
|
|
||||||
|
The build does not need to be done on the Pi.
|
||||||
|
|
||||||
|
To do so, go to ``tests/`` and call ``./build_arm.sh``, it will build all
|
||||||
|
necessary images for arm.
|
||||||
|
|
||||||
|
To push the locally built images to a remote server, run ``./deploy_to_pi.sh``.
|
||||||
|
Docker 18.09+ is needed to use ``-H ssh://<user>@<host>``.
|
||||||
|
|
||||||
|
Adjustments
|
||||||
|
-----------
|
||||||
|
|
||||||
|
``build_arm.sh`` uses some variables passed as ``build-arg`` to docker-compose:
|
||||||
|
|
||||||
|
- ``ALPINE_VER``: version of ALPINE to use
|
||||||
|
- ``DISTRO``: is the main distro used. Dockerfiles are set on Alpine 3.10, and
|
||||||
|
build script overrides for ``balenalib/rpi-alpine:3.10``
|
||||||
|
- ``QEMU``: Used by webmails dockerfiles. It will add ``qemu-arm-static`` only
|
||||||
|
if ``QEMU`` is set to ``arm``
|
||||||
|
- ``ARCH``: Architecture to use for ``admin``, and ``webmails`` as their images
|
||||||
|
are available for those architectures.
|
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash -x
|
||||||
|
|
||||||
|
ALPINE_VER="3.10"
|
||||||
|
DISTRO="balenalib/rpi-alpine:$ALPINE_VER"
|
||||||
|
# Used for webmails
|
||||||
|
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 ARCH=$ARCH \
|
||||||
|
--build-arg QEMU=$QEMU \
|
||||||
|
--parallel $@
|
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash -x
|
||||||
|
# Small script to deploy locally built images to a remote docker
|
||||||
|
compose_options=$1
|
||||||
|
images=$(docker-compose $1 images | awk 'NR > 2 { printf $2":"$3" " }')
|
||||||
|
docker save $images | pigz - > mail.local.tgz
|
||||||
|
echo "now run 'docker -H \"ssh://user@host\" load -i mail.local.tgz"
|
@ -0,0 +1 @@
|
|||||||
|
Add options to support different architectures builds
|
Loading…
Reference in New Issue