Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
v0.8
CrazyMax 2020-11-26 06:13:02 +01:00
parent 4140a8e176
commit 731ee4dde7
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
1 changed files with 23 additions and 3 deletions

View File

@ -25,6 +25,23 @@ if [ -z "$TAG" ] || [ -z "$REPO" ]; then
usage
fi
localmode=""
if [[ "$TAG" == "local" ]]; then
localmode="1"
if [ "$PUSH" = "push" ]; then
echo >&2 "local images cannot be pushed"
exit 1
fi
fi
outputFlag="--output=type=image,push=false"
if [ "$PUSH" = "push" ]; then
outputFlag="--output=type=image,push=true"
fi
if [ -n "$localmode" ]; then
outputFlag="--output=type=docker"
fi
pushFlag="push=false"
if [ "$PUSH" = "push" ]; then
pushFlag="push=true"
@ -55,13 +72,16 @@ if [[ -n "$cacheref" ]] && [[ "$cachetype" = "local" ]]; then
importCacheFlags="$importCacheFlags--cache-from=type=local,src=$ref "
done
fi
if [ -n "$localmode" ]; then
importCacheFlags=""
fi
exportCacheFlags=""
if [ "$PUSH" = "push" ]; then
exportCacheFlags="--cache-to=type=inline "
fi
buildxCmd build $targetFlag $importCacheFlags $exportCacheFlags \
buildxCmd build $targetFlag $importCacheFlags $exportCacheFlags $outputFlag \
--platform "$PLATFORMS" \
--output "type=image,name=$tagMain$tagLatest,$pushFlag" \
$currentref
--tag "$tagMain$tagLatest" \
$currentcontext