hack: add cross target

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2019-03-22 18:02:57 -07:00
parent f7d5b2c7ca
commit 5c8ddc85f7
3 changed files with 24 additions and 0 deletions

View File

@ -1 +1,2 @@
bin/ bin/
cross-out/

View File

@ -4,6 +4,9 @@ shell:
binaries: binaries:
./hack/binaries ./hack/binaries
binaries-cross:
EXPORT_LOCAL=cross-out ./hack/cross
install: binaries install: binaries
mkdir -p ~/.docker/cli-plugins mkdir -p ~/.docker/cli-plugins
cp bin/buildx ~/.docker/cli-plugins/docker-buildx cp bin/buildx ~/.docker/cli-plugins/docker-buildx

20
hack/cross Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
. $(dirname $0)/util
: ${TARGETPLATFORM=linux/amd64,linux/arm/v7,linux/arm64,darwin/amd64,windows/amd64,linux/ppc64le,linux/s390x}
: ${CONTINUOUS_INTEGRATION=}
: ${EXPORT_LOCAL=}
set -ex
exportFlag=""
if [ -n "$EXPORT_LOCAL" ]; then
exportFlag="--output=type=local,dest=$EXPORT_LOCAL"
fi
progressFlag=""
if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain";
fi
buildctl build $progressFlag --frontend=dockerfile.v0 --local context=. --local dockerfile=. --opt platform=$TARGETPLATFORM $exportFlag --opt target=binaries