[SPARK-24129][K8S] Add option to pass --build-arg's to docker-image-tool.sh
## What changes were proposed in this pull request? Adding `-b arg` option to take `--build-arg` parameters to pass into the docker command ## How was this patch tested? I verified by passing proxy details which fails without this change and succeeds with the changes. Author: Devaraj K <devaraj@apache.org> Closes #21202 from devaraj-kavali/SPARK-24129.
This commit is contained in:
parent
cd203e0dfc
commit
d404e54e64
|
@ -49,6 +49,7 @@ function build {
|
|||
# Set image build arguments accordingly if this is a source repo and not a distribution archive.
|
||||
IMG_PATH=resource-managers/kubernetes/docker/src/main/dockerfiles
|
||||
BUILD_ARGS=(
|
||||
${BUILD_PARAMS}
|
||||
--build-arg
|
||||
img_path=$IMG_PATH
|
||||
--build-arg
|
||||
|
@ -57,13 +58,14 @@ function build {
|
|||
else
|
||||
# Not passed as an argument to docker, but used to validate the Spark directory.
|
||||
IMG_PATH="kubernetes/dockerfiles"
|
||||
BUILD_ARGS=()
|
||||
BUILD_ARGS=(${BUILD_PARAMS})
|
||||
fi
|
||||
|
||||
if [ ! -d "$IMG_PATH" ]; then
|
||||
error "Cannot find docker image. This script must be run from a runnable distribution of Apache Spark."
|
||||
fi
|
||||
local BINDING_BUILD_ARGS=(
|
||||
${BUILD_PARAMS}
|
||||
--build-arg
|
||||
base_img=$(image_ref spark)
|
||||
)
|
||||
|
@ -101,6 +103,8 @@ Options:
|
|||
-t tag Tag to apply to the built image, or to identify the image to be pushed.
|
||||
-m Use minikube's Docker daemon.
|
||||
-n Build docker image with --no-cache
|
||||
-b arg Build arg to build or push the image. For multiple build args, this option needs to
|
||||
be used separately for each build arg.
|
||||
|
||||
Using minikube when building images will do so directly into minikube's Docker daemon.
|
||||
There is no need to push the images into minikube in that case, they'll be automatically
|
||||
|
@ -130,7 +134,8 @@ TAG=
|
|||
BASEDOCKERFILE=
|
||||
PYDOCKERFILE=
|
||||
NOCACHEARG=
|
||||
while getopts f:mr:t:n option
|
||||
BUILD_PARAMS=
|
||||
while getopts f:mr:t:n:b: option
|
||||
do
|
||||
case "${option}"
|
||||
in
|
||||
|
@ -139,6 +144,7 @@ do
|
|||
r) REPO=${OPTARG};;
|
||||
t) TAG=${OPTARG};;
|
||||
n) NOCACHEARG="--no-cache";;
|
||||
b) BUILD_PARAMS=${BUILD_PARAMS}" --build-arg "${OPTARG};;
|
||||
m)
|
||||
if ! which minikube 1>/dev/null; then
|
||||
error "Cannot find minikube."
|
||||
|
|
Loading…
Reference in a new issue