@@ -49,6 +49,7 @@ function build {
4949 # Set image build arguments accordingly if this is a source repo and not a distribution archive.
5050 IMG_PATH=resource-managers/kubernetes/docker/src/main/dockerfiles
5151 BUILD_ARGS=(
52+ ${BUILD_PARAMS}
5253 --build-arg
5354 img_path=$IMG_PATH
5455 --build-arg
@@ -57,7 +58,7 @@ function build {
5758 else
5859 # Not passed as an argument to docker, but used to validate the Spark directory.
5960 IMG_PATH=" kubernetes/dockerfiles"
60- BUILD_ARGS=()
61+ BUILD_ARGS=(${BUILD_PARAMS} )
6162 fi
6263
6364 if [ ! -d " $IMG_PATH " ]; then
@@ -89,6 +90,8 @@ Options:
8990 -f file Dockerfile to build. By default builds the Dockerfile shipped with Spark.
9091 -r repo Repository address.
9192 -t tag Tag to apply to the built image, or to identify the image to be pushed.
93+ -b arg Build arg to build or push the image. For multiple build args, this option needs to
94+ be used separately for each build arg.
9295 -m Use minikube's Docker daemon.
9396
9497Using minikube when building images will do so directly into minikube's Docker daemon.
117120REPO=
118121TAG=
119122DOCKERFILE=
120- while getopts f:mr:t: option
123+ BUILD_PARAMS=
124+ while getopts f:mr:t:b: option
121125do
122126 case " ${option} "
123127 in
124128 f) DOCKERFILE=${OPTARG} ;;
125129 r) REPO=${OPTARG} ;;
126130 t) TAG=${OPTARG} ;;
131+ b) BUILD_PARAMS=${BUILD_PARAMS} " --build-arg " ${OPTARG} ;;
127132 m)
128133 if ! which minikube 1> /dev/null; then
129134 error " Cannot find minikube."
0 commit comments