Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support automated ARM builds #1261

Closed
ahoarau opened this issue Nov 27, 2017 · 9 comments

Comments

@ahoarau
Copy link

commented Nov 27, 2017

Currently it is not possible to launch an automated arm build on the Hub because the hosts does not seem to have qemu-user-static.
Is there an alternate solution to this ?

@pchico83

This comment has been minimized.

Copy link

commented Nov 28, 2017

You could install the package is the post_checkout hook:
https://docs.docker.com/docker-cloud/builds/advanced/
It is also supported in Docker Hub.

@ahoarau

This comment has been minimized.

Copy link
Author

commented Nov 28, 2017

Cool. So I shall create a docker-compose.test.yml file in my github repo, and docker hub will automatically read it ?

@pchico83

This comment has been minimized.

Copy link

commented Nov 28, 2017

Yes, that is possible. But you can also defined your own hooks.
For example, you could create a post_checkout file in a hooks folder at the level of your Dockerfile, and that script will be executed after checking out your github repo. You could use it to install apt-get packages (our build machines are Ubuntu Trusty).

@jcsrb

This comment has been minimized.

Copy link

commented Aug 28, 2018

@ahoarau did you create such a workflow, you link to it?

@ahoarau

This comment has been minimized.

Copy link
Author

commented Aug 28, 2018

@jcsrb nope did not managed to make it work on the hub. Running locally instead.

@davidecavestro

This comment has been minimized.

Copy link

commented Nov 22, 2018

@pchico83 it works like a charm!
@ahoarau it turns out to be just a matter of registering qemu-arm-static before launching the build

See mariadb-docker-armhf (WIP):

.
├── Dockerfile
└── hooks
     ├── post_checkout
     └── pre_build

hooks/post_checkout

#!/bin/bash
# downloads a local copy of qemu on docker-hub build machines
curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static .

hooks/pre_build

#!/bin/bash
# Register qemu-*-static for all supported processors except the 
# current one, but also remove all registered binfmt_misc before
docker run --rm --privileged multiarch/qemu-user-static:register --reset

Dockerfile

FROM arm32v7/debian:stretch-slim 
COPY qemu-arm-static /usr/bin
...

Probably it can be further reduced.
Now the job fails just for a matter of timeout (huge build) but the arm stuff simply works :-)

@ahoarau

This comment has been minimized.

Copy link
Author

commented Nov 23, 2018

@davidecavestro excellent ! I guess the issue is closed now :)

@ahoarau ahoarau closed this Nov 23, 2018
outlyer-net added a commit to outlyer-net/resiliosync-docker-multiarch that referenced this issue May 5, 2019
Imported from the davidecavestro/mariadb-docker-armhf repository as per docker/hub-feedback#1261
vladimir-kotikov added a commit to vladimir-kotikov/raspberrypi3-homeassistant that referenced this issue May 8, 2019
@se1exin

This comment has been minimized.

Copy link

commented May 11, 2019

FYI this did not work for me - Docker Hub build cannot find the qemu-arm-static file:

...
Step 6/10 : COPY qemu-arm-static /usr/bin
COPY failed: stat /var/lib/docker/tmp/docker-builder403015795/qemu-arm-static: no such file or directory

I worked around it by removing the post_checkout file and using a builder/mutlistage Dockerfile to download the qemu-arm-static binary inside the container instead.

Example Dockerfile:

FROM golang:1.12.0 AS builder
# ... my go build steps (removed from this example)
WORKDIR /builder/working/directory
RUN curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static .

FROM arm32v7/alpine:latest
# Copy across the qemu binary that was downloaded in the previous build step
COPY --from=builder /builder/working/directory/qemu-arm-static /usr/bin
# Now you can tun ARM docker steps.. yay!

Note I'm using golang as my builder image, but I'm sure any amd64 image with curl and tar would work fine. My full Dockerfile is here if it might help anyone: https://github.com/se1exin/Hue-Im-Home/blob/a39ab7c78db2564f767527519d18d8c1faf964cd/docker/Dockerfile.arm32v7

awesometic referenced this issue in awesometic/docker-mkdocs-material-arm64 Jul 25, 2019
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
awesometic referenced this issue in awesometic/docker-mkdocs-material-arm64 Jul 25, 2019
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
awesometic referenced this issue in awesometic/docker-mkdocs-material-arm64 Jul 29, 2019
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
@marklagendijk

This comment has been minimized.

Copy link

commented Sep 2, 2019

This is related #1874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.