2019-01-26 06:29:13 +00:00
|
|
|
#!/usr/bin/env sh
|
2018-09-13 21:21:11 +00:00
|
|
|
|
2018-10-02 17:03:32 +00:00
|
|
|
: ${PREFER_BUILDCTL=}
|
2018-09-13 21:21:11 +00:00
|
|
|
: ${PREFER_LEGACY=}
|
|
|
|
|
|
|
|
newerEqualThan() { # $1=minimum wanted version $2=actual-version
|
|
|
|
[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n 1)" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
buildmode="legacy"
|
2019-01-26 06:29:13 +00:00
|
|
|
if [ "$PREFER_BUILDCTL" = "1" ]; then
|
2018-09-13 21:21:11 +00:00
|
|
|
buildmode="buildkit";
|
|
|
|
else
|
|
|
|
serverVersion=$(docker info --format '{{.ServerVersion}}')
|
|
|
|
experimental=$(docker info --format '{{.ExperimentalBuild}}')
|
|
|
|
if [ "$PREFER_LEGACY" != "1" ] && ( newerEqualThan "18.09" $serverVersion || \
|
|
|
|
( newerEqualThan "18.06" $serverVersion && [ "true" = "$experimental" ] ) || \
|
|
|
|
[ "$DOCKER_BUILDKIT" = "1" ]); then
|
|
|
|
buildmode="docker-buildkit";
|
|
|
|
fi
|
2019-01-26 06:29:13 +00:00
|
|
|
fi
|