parent
4140a8e176
commit
731ee4dde7
26
hack/images
26
hack/images
|
@ -25,6 +25,23 @@ if [ -z "$TAG" ] || [ -z "$REPO" ]; then
|
||||||
usage
|
usage
|
||||||
fi
|
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"
|
pushFlag="push=false"
|
||||||
if [ "$PUSH" = "push" ]; then
|
if [ "$PUSH" = "push" ]; then
|
||||||
pushFlag="push=true"
|
pushFlag="push=true"
|
||||||
|
@ -55,13 +72,16 @@ if [[ -n "$cacheref" ]] && [[ "$cachetype" = "local" ]]; then
|
||||||
importCacheFlags="$importCacheFlags--cache-from=type=local,src=$ref "
|
importCacheFlags="$importCacheFlags--cache-from=type=local,src=$ref "
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$localmode" ]; then
|
||||||
|
importCacheFlags=""
|
||||||
|
fi
|
||||||
|
|
||||||
exportCacheFlags=""
|
exportCacheFlags=""
|
||||||
if [ "$PUSH" = "push" ]; then
|
if [ "$PUSH" = "push" ]; then
|
||||||
exportCacheFlags="--cache-to=type=inline "
|
exportCacheFlags="--cache-to=type=inline "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
buildxCmd build $targetFlag $importCacheFlags $exportCacheFlags \
|
buildxCmd build $targetFlag $importCacheFlags $exportCacheFlags $outputFlag \
|
||||||
--platform "$PLATFORMS" \
|
--platform "$PLATFORMS" \
|
||||||
--output "type=image,name=$tagMain$tagLatest,$pushFlag" \
|
--tag "$tagMain$tagLatest" \
|
||||||
$currentref
|
$currentcontext
|
||||||
|
|
Loading…
Reference in New Issue