Hilscher Community Forum
Build automated images on Docker Hub - Printable Version

+- Hilscher Community Forum (https://forum.hilscher.com)
+-- Forum: netPI 3 - Docker featuring Industrial Raspberry Pi 3 platform (https://forum.hilscher.com/forum-1.html)
+--- Forum: Software (https://forum.hilscher.com/forum-5.html)
+--- Thread: Build automated images on Docker Hub (/thread-268.html)



Answer - Armin@netPI - November-23rd-2017

Preconditions for an automated build are:
[ul]
[li]You need a Docker Hub account[/li]
[li]You need a Github account[/li]
[li]You need to create a repository on Docker Hub in automated mode[/li]
[/ul]

How to setup a Docker image repository to be built automated on Docker Hub servers can be read here.

Next to a Docker Hub account a Github account is needed to allow Docker Hub accessing your sources during the web build process.

A file named Dockerfile is basis for any built process whether it is built remotely on the web or locally using the Docker (CLI) Command Line Interface (if you have access to it).

This file contains the command instructions in adjacent order executed during the build process. There is just a set of maybe 10 commands the Dockerfile interpreter understands.

When creating a new repository on your Docker Hub registry you can specify whether or not it is of type automated under the tab create.

If you chose Create Automated Build you have to link your repo to the Github sources. After that you can immediately start the build process if the Github account contains the Dockerfile at least. When finished the built image will be placed on your repository ready for download.

As you can imagine Docker Hub servers are all x86 based platforms. Actually they can't generate ARM processor based code needed for a Raspberry compatible output. With the following trick described here you can extend your Dockerfile by a set of files moving Docker Hub to emulate an ARM CPU during build process. Precondition is that your automated build rely on base images provided by group resin.io containing the ARM software emulator QEMU.

Here is a code extract of how to prepare your Dockerfile for an automated web build:

FROM resin/... (can be any resin.io ARM base image)

ENV QEMU_EXECVE 1
COPY armv7hf-debian-qemu /usr/bin
RUN [ "cross-build-start" ]

... all your other commands

RUN [ "cross-build-end" ]


The script cross-build-start brings the build server into a state to use the QEMU ARM software emulator that is part of any resin.io base image on all next commands. The script cross-build-end at the end exits the emulation mode.

The script files you need can be obtained from here to copy them over to your github repository into the folder armv7hf-debian-qemu in the example above.