Move build to a single file
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
IamTheFij 2020-01-30 11:54:40 -08:00
parent 978fb1991f
commit 7bc4392f5f
3 changed files with 6 additions and 29 deletions

View File

@ -30,11 +30,6 @@ trigger:
- refs/tags/v* - refs/tags/v*
steps: steps:
- name: get qemu
image: busybox
commands:
- sh ./get_qemu.sh x86_64
- name: build - name: build
image: plugins/docker image: plugins/docker
settings: settings:
@ -62,11 +57,6 @@ trigger:
- refs/tags/v* - refs/tags/v*
steps: steps:
- name: get qemu
image: busybox
commands:
- sh ./get_qemu.sh arm
- name: build - name: build
image: plugins/docker image: plugins/docker
settings: settings:
@ -97,11 +87,6 @@ trigger:
- refs/tags/v* - refs/tags/v*
steps: steps:
- name: get qemu
image: busybox
commands:
- sh ./get_qemu.sh aarch64
- name: build - name: build
image: plugins/docker image: plugins/docker
settings: settings:

View File

@ -2,11 +2,13 @@
# The following will work with any library image that supports multi-arch # The following will work with any library image that supports multi-arch
# Other repositories may use tag suffix instead # Other repositories may use tag suffix instead
ARG REPO=library ARG REPO=library
FROM multiarch/qemu-user-static:4.2.0-2 as qemu-user-static
FROM ${REPO}/python:3-alpine FROM ${REPO}/python:3-alpine
# This should be the target qemu arch # This should be the target qemu arch
ARG ARCH=x86_64 ARG ARCH=x86_64
COPY ./build/qemu-${ARCH}-static /usr/bin/ COPY --from=qemu-user-static /usr/bin/qemu-* /usr/bin/
# Everything below here is just a simple example # Everything below here is just a simple example

View File

@ -7,28 +7,18 @@ default: test
test: test:
@echo ok @echo ok
# Targets to download required qemu binaries for running on an amd64 machine
build/qemu-x86_64-static:
./get_qemu.sh x86_64
build/qemu-arm-static:
./get_qemu.sh arm
build/qemu-aarch64-static:
./get_qemu.sh aarch64
# Build Docker image for host architechture (amd64) # Build Docker image for host architechture (amd64)
.PHONY: build .PHONY: build
build: build/qemu-x86_64-static build:
docker build . -t ${DOCKER_TAG}-linux-amd64 docker build . -t ${DOCKER_TAG}-linux-amd64
# Cross build for arm architechtures # Cross build for arm architechtures
.PHONY: cross-build-arm .PHONY: cross-build-arm
cross-build-arm: build/qemu-arm-static cross-build-arm:
docker build --build-arg REPO=arm32v6 --build-arg ARCH=arm . -t ${DOCKER_TAG}-linux-arm docker build --build-arg REPO=arm32v6 --build-arg ARCH=arm . -t ${DOCKER_TAG}-linux-arm
.PHONY: cross-build-arm .PHONY: cross-build-arm
cross-build-arm64: build/qemu-aarch64-static cross-build-arm64:
docker build --build-arg REPO=arm64v8 --build-arg ARCH=aarch64 . -t ${DOCKER_TAG}-linux-arm64 docker build --build-arg REPO=arm64v8 --build-arg ARCH=aarch64 . -t ${DOCKER_TAG}-linux-arm64
# Run on host architechture # Run on host architechture