femtopixel/multiarchbuilder
Docker image to build multiarch docker (Docker in docker FTW)
500
The purpose of this project is to build a Multiarch Docker image in a x86/64 CI/CD context.
Here is an example if .gitlab-ci.yml
file to compile
image: femtopixel/multiarchbuilder
variables:
DOCKER_HOST: "tcp://docker:2375"
services:
- docker:dind
stages:
- build
build:
stage: build
only:
- master
before_script:
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
- git clone https://github.com/estesp/manifest-tool && cd manifest-tool && make && make install && cd .. && rm -Rf manifest-tool
- git clone https://github.com/computermouth/qemu-static-conf.git && mkdir -p /lib/binfmt.d && cp qemu-static-conf/*.conf /lib/binfmt.d/ && systemctl restart systemd-binfmt.service
- echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_HUB_LOGIN" --password-stdin
script:
- make build
With this, your build task in your Makefile will be able to build an image for other architectures without needing to add qemu into your dockerfiles. Here is the magic :
binfmt-support
is installed in femtopixel/multiarchbuild
qemu
is installed in femtopixel/multiarchbuild
docker
is installed in femtopixel/multiarchbuild
If you don't have Docker installed yet, you can do it easily in one line using this command
curl -sSL "https://gist.githubusercontent.com/jaymoulin/e749a189511cd965f45919f2f99e45f3/raw/0e650b38fde684c4ac534b254099d6d5543375f1/ARM%2520(Raspberry%2520PI)%2520Docker%2520Install" | sudo sh && sudo usermod -aG docker $USER
docker pull femtopixel/multiarchbuilder