mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2025-01-09 02:20:18 +01:00
57 lines
2.2 KiB
Text
57 lines
2.2 KiB
Text
|
#!/usr/bin/env bash
|
||
|
set -eu
|
||
|
|
||
|
echo "build"
|
||
|
source hooks/.config
|
||
|
|
||
|
echo "Will build the following architectures: $verified_build_architectures"
|
||
|
echo "⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯"
|
||
|
|
||
|
for arch in ${verified_build_architectures[@]}; do
|
||
|
echo "building $arch"
|
||
|
echo "⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯"
|
||
|
|
||
|
BASE_IMAGE_PREFIX="${base_image_prefix_map[${arch}]}"
|
||
|
docker build \
|
||
|
--build-arg GOOS=linux \
|
||
|
--build-arg GOARCH=${arch} \
|
||
|
--file $DOCKERFILE_PATH \
|
||
|
--tag "${IMAGE_NAME}-${arch}" \
|
||
|
.
|
||
|
done
|
||
|
|
||
|
echo "images built:"
|
||
|
echo "⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯"
|
||
|
docker image ls
|
||
|
|
||
|
# https://github.com/moby/moby/issues/36552
|
||
|
#
|
||
|
tempdir=$(mktemp -d -t yolo.XXXXXXXX)
|
||
|
cd $tempdir
|
||
|
|
||
|
for arch in ${verified_build_architectures[@]}; do
|
||
|
echo "yolo fixing platform $arch"
|
||
|
echo "⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯"
|
||
|
|
||
|
manifest_arch=${docker_to_manifest_map[${arch}]}
|
||
|
docker save "${IMAGE_NAME}-${arch}"| tar xv
|
||
|
|
||
|
for filename in */json; do
|
||
|
[ -e "$filename" ] || continue
|
||
|
jq --compact-output 'del(.architecture)' < "$filename" | sponge "$filename"
|
||
|
done
|
||
|
|
||
|
for filename in *.json; do
|
||
|
[ -e "$filename" ] || continue
|
||
|
! [ $filename = "manifest.json" ] || continue
|
||
|
|
||
|
jq --arg architecture "$manifest_arch" \
|
||
|
--compact-output '.architecture=$architecture' < "$filename" | sponge "$filename"
|
||
|
done
|
||
|
|
||
|
tar cv . | docker load
|
||
|
rm -rf $tempdir/*
|
||
|
done
|
||
|
|
||
|
trap "exit 1" HUP INT PIPE QUIT TERM
|
||
|
trap "rm -rf $tempdir" EXIT
|