From c564d5a2f72120fdb831de70692c35a2cd840d59 Mon Sep 17 00:00:00 2001 From: redxef Date: Sun, 1 Nov 2020 13:04:22 +0100 Subject: [PATCH] Build multiarch containers. --- arch.txt | 35 +++++++++++++++++++++++++++++++++++ build.sh | 19 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 arch.txt create mode 100755 build.sh diff --git a/arch.txt b/arch.txt new file mode 100644 index 0000000..2a6787b --- /dev/null +++ b/arch.txt @@ -0,0 +1,35 @@ +aarch64 +# aarch64_be +# alpha +arm +# armeb +# cris +# hppa +i386 +# m68k +# microblaze +# microblazeel +# mips +# mips64 +# mips64el +# mipsel +# mipsn32 +# mipsn32el +# nios2 +# or1k +# ppc +# ppc64 +# ppc64abi32 +ppc64le +# riscv32 +# riscv64 +s390x +# sh4 +# sh4eb +# sparc +# sparc32plus +# sparc64 +# tilegx +x86_64 +# xtensa +# xtensaeb diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..c14ac3e --- /dev/null +++ b/build.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +platforms() { + local plat="$(grep '^[^#].*' < arch.txt)" + local arch_count="$(echo "$plat" | wc -l)" + echo "$plat" | tr '\n' ',' | cut -d, -f1-$arch_count +} + +create() { + docker buildx create --use +} + +build() { + local tagname="$1" + docker pull 'alpine:latest' + docker buildx build --push --tag="$tagname" --platform="$(platforms)" . +} + +"$@"