Compare commits
14 Commits
test-branc
...
master
Author | SHA1 | Date | |
---|---|---|---|
e27af3b995 | |||
5268a8d467 | |||
aed73fe158 | |||
efb29fc022 | |||
079057ace5 | |||
cba660bf03 | |||
a35ae1081b | |||
7b99514459 | |||
a4104a5201 | |||
3594fd1de3 | |||
33e42659fc | |||
6ec3055815 | |||
7bc4392f5f | |||
978fb1991f |
106
.drone.yml
106
.drone.yml
@ -1,25 +1,6 @@
|
||||
kind: pipeline
|
||||
name: tests
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
|
||||
steps:
|
||||
- name: run tests
|
||||
image: ubuntu:bionic
|
||||
commands:
|
||||
- apt-get update
|
||||
- apt-get install -y make
|
||||
- make test
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: linux-amd64
|
||||
|
||||
depends_on:
|
||||
- tests
|
||||
name: docker builds
|
||||
|
||||
trigger:
|
||||
event:
|
||||
@ -30,84 +11,35 @@ trigger:
|
||||
- refs/tags/v*
|
||||
|
||||
steps:
|
||||
- name: get qemu
|
||||
image: busybox
|
||||
commands:
|
||||
- sh ./get_qemu.sh x86_64
|
||||
|
||||
- name: build
|
||||
- name: build amd64
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: iamthefij/multiarch-pipeline-test
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64
|
||||
auto_tag_suffix: drone-amd64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: linux-arm
|
||||
|
||||
depends_on:
|
||||
- tests
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/tags/v*
|
||||
|
||||
steps:
|
||||
- name: get qemu
|
||||
image: busybox
|
||||
commands:
|
||||
- sh ./get_qemu.sh arm
|
||||
|
||||
- name: build
|
||||
- name: build arm32v7
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: iamthefij/multiarch-pipeline-test
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm
|
||||
auto_tag_suffix: drone-arm
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
build_args:
|
||||
- ARCH=arm
|
||||
- REPO=arm32v6
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: linux-arm64
|
||||
|
||||
depends_on:
|
||||
- tests
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/tags/v*
|
||||
|
||||
steps:
|
||||
- name: get qemu
|
||||
image: busybox
|
||||
commands:
|
||||
- sh ./get_qemu.sh aarch64
|
||||
|
||||
- name: build
|
||||
- REPO=arm32v7
|
||||
- name: build-arm64
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: iamthefij/multiarch-pipeline-test
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
auto_tag_suffix: drone-arm64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
@ -115,33 +47,13 @@ steps:
|
||||
build_args:
|
||||
- ARCH=aarch64
|
||||
- REPO=arm64v8
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: manifest
|
||||
|
||||
depends_on:
|
||||
- linux-amd64
|
||||
- linux-arm
|
||||
- linux-arm64
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- refs/tags/v*
|
||||
|
||||
steps:
|
||||
- name: publish manifest
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
spec: manifest.tmpl
|
||||
spec: drone-manifest.tmpl
|
||||
auto_tag: true
|
||||
ignore_missing: true
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
|
||||
|
10
Dockerfile
10
Dockerfile
@ -2,11 +2,19 @@
|
||||
# The following will work with any library image that supports multi-arch
|
||||
# Other repositories may use tag suffix instead
|
||||
ARG REPO=library
|
||||
FROM multiarch/qemu-user-static:4.2.0-2 as qemu-user-static
|
||||
|
||||
# On some systems, touching a dummy file in the /usr/bin dir doesn't work
|
||||
# and instead removes all files previously in the directory. Not sure why
|
||||
# this is happening. Moving everything to a different directory seems to
|
||||
# work fine though.
|
||||
RUN mkdir /qemu && touch /qemu/qemu-x86_64-dummy && cp /usr/bin/qemu-* /qemu/
|
||||
|
||||
FROM ${REPO}/python:3-alpine
|
||||
|
||||
# This should be the target qemu arch
|
||||
ARG ARCH=x86_64
|
||||
COPY ./build/qemu-${ARCH}-static /usr/bin/
|
||||
COPY --from=qemu-user-static /qemu/qemu-${ARCH}-* /usr/bin/
|
||||
|
||||
# Everything below here is just a simple example
|
||||
|
||||
|
16
Makefile
16
Makefile
@ -7,28 +7,18 @@ default: test
|
||||
test:
|
||||
@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)
|
||||
.PHONY: build
|
||||
build: build/qemu-x86_64-static
|
||||
build:
|
||||
docker build . -t ${DOCKER_TAG}-linux-amd64
|
||||
|
||||
# Cross build for arm architechtures
|
||||
.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
|
||||
|
||||
.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
|
||||
|
||||
# Run on host architechture
|
||||
|
@ -7,18 +7,18 @@ tags:
|
||||
{{/if}}
|
||||
manifests:
|
||||
-
|
||||
image: iamthefij/multiarch-pipeline-test:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
image: iamthefij/multiarch-pipeline-test:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}drone-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: iamthefij/multiarch-pipeline-test:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
image: iamthefij/multiarch-pipeline-test:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}drone-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
variant: v8
|
||||
-
|
||||
image: iamthefij/multiarch-pipeline-test:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||
image: iamthefij/multiarch-pipeline-test:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}drone-arm
|
||||
platform:
|
||||
architecture: arm
|
||||
os: linux
|
14
get_qemu.sh
14
get_qemu.sh
@ -1,14 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
HOST_ARCH=x86_64
|
||||
VERSION=v2.9.1-1
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
# Multiple args can be passed in, but in most cases (Makefile and .drone.yml) we only use one at a time
|
||||
for target_arch in $*; do
|
||||
wget 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
|
Loading…
Reference in New Issue
Block a user