Unverified Commit 96e42f72 authored by Ran Rubin's avatar Ran Rubin Committed by GitHub
Browse files

build: build.sh enhancement (#5053)

parent 07721d1c
......@@ -132,6 +132,8 @@ NIXL_LIBFABRIC_REF=v2.3.0
EFA_VERSION=1.45.1
NO_CACHE=""
NO_LOAD=""
PUSH=""
# KVBM (KV Cache Block Manager) - default disabled, enabled automatically for VLLM/TRTLLM
# or can be explicitly enabled via --enable-kvbm flag
......@@ -283,6 +285,12 @@ get_options() {
--no-cache)
NO_CACHE=" --no-cache"
;;
--no-load)
NO_LOAD=true
;;
--push)
PUSH=" --push"
;;
--cache-from)
if [ "$2" ]; then
CACHE_FROM+="--cache-from $2 "
......@@ -488,6 +496,8 @@ show_help() {
echo " [--uid user ID for local-dev images (only with --target local-dev)]"
echo " [--gid group ID for local-dev images (only with --target local-dev)]"
echo " [--no-cache disable docker build cache]"
echo " [--no-load do not load the image into docker (disables default --load)]"
echo " [--push push the image to the registry]"
echo " [--dry-run print docker commands without running]"
echo " [--build-context name=path to add build context]"
echo " [--release-build perform a release build]"
......@@ -942,9 +952,15 @@ BUILD_LOG_DIR="${BUILD_CONTEXT}/build-logs"
mkdir -p "${BUILD_LOG_DIR}"
SINGLE_BUILD_LOG="${BUILD_LOG_DIR}/single-stage-build.log"
# Determine --load flag (default on unless --no-load or --push specified)
LOAD_FLAG=""
if [ "$NO_LOAD" != "true" ] && [ -z "$PUSH" ]; then
LOAD_FLAG=" --load"
fi
# Use BuildKit for enhanced metadata
if docker buildx version &>/dev/null; then
$RUN_PREFIX docker buildx build --progress=plain --load -f $DOCKERFILE $TARGET_STR $PLATFORM $BUILD_ARGS $CACHE_FROM $CACHE_TO $TAG $LATEST_TAG $BUILD_CONTEXT_ARG $BUILD_CONTEXT $NO_CACHE 2>&1 | tee "${SINGLE_BUILD_LOG}"
$RUN_PREFIX docker buildx build --progress=plain${LOAD_FLAG}${PUSH} -f $DOCKERFILE $TARGET_STR $PLATFORM $BUILD_ARGS $CACHE_FROM $CACHE_TO $TAG $LATEST_TAG $BUILD_CONTEXT_ARG $BUILD_CONTEXT $NO_CACHE 2>&1 | tee "${SINGLE_BUILD_LOG}"
BUILD_EXIT_CODE=${PIPESTATUS[0]}
else
$RUN_PREFIX DOCKER_BUILDKIT=1 docker build --progress=plain -f $DOCKERFILE $TARGET_STR $PLATFORM $BUILD_ARGS $CACHE_FROM $CACHE_TO $TAG $LATEST_TAG $BUILD_CONTEXT_ARG $BUILD_CONTEXT $NO_CACHE 2>&1 | tee "${SINGLE_BUILD_LOG}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment