This commit is contained in:
IamTheFij 2019-03-08 17:12:03 -08:00
commit 85bfa2a615
6 changed files with 79 additions and 0 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
README.md
Makefile

18
.drone.yml Normal file
View File

@ -0,0 +1,18 @@
kind: pipeline
name: amd64
steps:
- name: build
image: docker
commands:
- make build
---
kind: pipeline
name: arm
steps:
- name: build
image: docker
commands:
- make cross-build-arm

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
qemu-*
*.tar.gz

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
ARG REPO=library
FROM ${REPO}/python:3-alpine
ARG ARCH=x86_64
COPY ./build/qemu-${ARCH}-static /usr/bin/
RUN echo "OK" > /foo
CMD [ "cat", "/foo" ]

33
Makefile Normal file
View File

@ -0,0 +1,33 @@
DOCKER_TAG ?= multiarch-test-${USER}
.PHONY: default
default: test
.PHONY:test
test:
@echo ok
.PHONY: build
build: build/qemu-x86_64-static
docker build . -t ${DOCKER_TAG}
build/qemu-arm-static:
./get_qemu.sh
build/qemu-x86_64-static:
./get_qemu.sh
build/qemu-aarch64-static:
./get_qemu.sh
.PHONY: cross-build-arm
cross-build-arm: build/qemu-arm-static
docker build --build-arg REPO=arm32v6 --build-arg ARCH=arm . -t ${DOCKER_TAG}-arm32v6
.PHONY: run
run: build
docker run ${DOCKER_TAG}
.PHONY: run
cross-run-arm: cross-build-arm
docker run --rm ${DOCKER_TAG}-arm32v6

13
get_qemu.sh Executable file
View File

@ -0,0 +1,13 @@
#! /bin/bash
HOST_ARCH=x86_64
VERSION=v2.9.1-1
mkdir -p build
cd build
for target_arch in aarch64 arm x86_64; do
wget -N https://github.com/multiarch/qemu-user-static/releases/download/$VERSION/${HOST_ARCH}_qemu-${target_arch}-static.tar.gz
tar -xvf ${HOST_ARCH}_qemu-${target_arch}-static.tar.gz
rm ${HOST_ARCH}_qemu-${target_arch}-static.tar.gz
done