#!/usr/bin/env sh export BUILDX_NO_DEFAULT_LOAD=true : ${PREFER_BUILDCTL=} : ${PREFER_LEGACY=} : ${CI=} : ${GITHUB_ACTIONS=} : ${CACHE_FROM=} : ${CACHE_TO=} if [ "$PREFER_BUILDCTL" = "1" ]; then echo >&2 "WARNING: PREFER_BUILDCTL is no longer supported. Ignoring." fi if [ "$PREFER_LEGACY" = "1" ]; then echo >&2 "WARNING: PREFER_LEGACY is no longer supported. Ignoring." fi progressFlag="" if [ "$CI" = "true" ]; then progressFlag="--progress=plain" fi buildxCmd() { if docker buildx version >/dev/null 2>&1; then set -x docker buildx "$@" $progressFlag elif buildx version >/dev/null 2>&1; then set -x buildx "$@" $progressFlag else topdir="$(realpath $(dirname "$0")/..)" if [ ! -x "${topdir}/bin/buildx" ]; then set -x "${topdir}/hack/install-buildx" fi set -x bootstrapName="moby-buildkit" "${topdir}/hack/bootstrap-buildx" "${bootstrapName}" BUILDX_BUILDER="${bootstrapName}" "${topdir}/bin/buildx" "$@" $progressFlag fi } currentref="" currentcontext="." cacheFromFlags="" cacheToFlags="" if [ "$GITHUB_ACTIONS" = "true" ]; then currentref="https://github.com/$GITHUB_REPOSITORY.git#$GITHUB_REF" if [ -n "$CACHE_FROM" ]; then for cfrom in $CACHE_FROM; do cacheFromFlags="${cacheFromFlags}--cache-from=$cfrom " done fi if [ -n "$CACHE_TO" ]; then for cto in $CACHE_TO; do cacheToFlags="${cacheToFlags}--cache-to=$cto " done fi fi if [ -n "$currentref" ]; then currentcontext="--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 $currentref" fi