Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions operators/bake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ BUILD_BASE=false
PUSH_LOCAL=false
PUSH_REMOTE=false
PULL_LOCAL=false
DRY_RUN=false
TARGET=""

# Parse args
Expand All @@ -36,6 +37,10 @@ while [[ $# -gt 0 ]]; do
VARS="$OPERATORS_DIR/vars-prod.hcl"
shift
;;
--dry-run)
DRY_RUN=true
shift
;;
--target)
TARGET="$2"
shift 2
Expand All @@ -57,14 +62,18 @@ cd "$REPO_ROOT_DIR"


if $BUILD_BASE; then
base_cmd=(docker buildx bake)
if $DRY_RUN; then
base_cmd+=(--print)
fi
echo "=== Building base images ==="
docker buildx bake base --file "$BAKE_FILE" \
"${base_cmd[@]}" base --file "$BAKE_FILE" \
--file "$BASE_VARS"

docker buildx bake operator --file "$BAKE_FILE" \
"${base_cmd[@]}" operator --file "$BAKE_FILE" \
--file "$BASE_VARS"

docker buildx bake distiller-streaming --file "$BAKE_FILE" \
"${base_cmd[@]}" distiller-streaming --file "$BAKE_FILE" \
--file "$BASE_VARS"
fi

Expand All @@ -77,11 +86,15 @@ build_operators() {

if [ -n "$TARGET" ]; then
cmd+=("$TARGET")
cmd+=(--provenance=false)
else
cmd+=(operators)
fi

cmd+=(--provenance=false)

# https://docs.docker.com/build/exporters/image-registry/
# https://docs.docker.com/reference/cli/docker/buildx/build/#output
cmd+=(--set "*.output=type=registry,oci-mediatypes=true")
cmd+=(--file "$BAKE_FILE")
cmd+=(--file "$VARS")

Expand All @@ -96,15 +109,17 @@ build_operators() {
fi
fi
done

# Check if we found any labels
if [ "$has_labels" = false ]; then
echo "No operator.json files found or all are empty."
return 1
fi

cmd+=(--push)


if $DRY_RUN; then
cmd+=(--print)
fi

# Execute the command
"${cmd[@]}"
}
Expand Down
Loading