Make docker build target optional

This commit is contained in:
estebanthi
2026-01-04 17:03:17 +01:00
parent c001f91b5e
commit 6bf910dff1

View File

@@ -114,9 +114,14 @@ jobs:
BUILD_ARG_FLAGS=$(printf -- "--build-arg %s " $BUILD_ARGS) BUILD_ARG_FLAGS=$(printf -- "--build-arg %s " $BUILD_ARGS)
fi fi
TARGET_FLAG=""
if [ -n "$TARGET" ] && [ "$TARGET" != "null" ]; then
TARGET_FLAG="--target $TARGET"
fi
docker buildx build \ docker buildx build \
--file "$DOCKERFILE" \ --file "$DOCKERFILE" \
--target "$TARGET" \ $TARGET_FLAG \
--cache-from "type=registry,ref=$CACHE_REF" \ --cache-from "type=registry,ref=$CACHE_REF" \
--cache-to "type=registry,ref=$CACHE_REF,mode=max" \ --cache-to "type=registry,ref=$CACHE_REF,mode=max" \
$SSH_FLAGS \ $SSH_FLAGS \