2019-04-24 08:12:02 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
2022-10-24 05:03:55 +08:00
|
|
|
: "${BUILDX_CMD=docker buildx}"
|
|
|
|
: "${DESTDIR=./bin/release}"
|
|
|
|
: "${CACHE_FROM=}"
|
|
|
|
: "${CACHE_TO=}"
|
2022-05-06 17:55:49 +08:00
|
|
|
|
|
|
|
if [ -n "$CACHE_FROM" ]; then
|
|
|
|
for cfrom in $CACHE_FROM; do
|
|
|
|
cacheFlags+=(--set "*.cache-from=$cfrom")
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
if [ -n "$CACHE_TO" ]; then
|
|
|
|
for cto in $CACHE_TO; do
|
|
|
|
cacheFlags+=(--set "*.cache-to=$cto")
|
|
|
|
done
|
|
|
|
fi
|
2019-04-24 08:12:02 +08:00
|
|
|
|
2021-09-04 04:49:59 +08:00
|
|
|
# release
|
2022-10-24 05:03:55 +08:00
|
|
|
(set -x ; ${BUILDX_CMD} bake "${cacheFlags[@]}" --set "*.output=$DESTDIR" release)
|
2021-07-02 13:18:11 +08:00
|
|
|
|
|
|
|
# wrap binaries
|
2022-10-24 05:03:55 +08:00
|
|
|
mv -f ./${DESTDIR}/**/* ./${DESTDIR}/
|
|
|
|
find ./${DESTDIR} -type d -empty -delete
|
2021-08-02 09:37:31 +08:00
|
|
|
|
2022-08-04 02:52:57 +08:00
|
|
|
source ./hack/hash-files
|