Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d01e54

Browse files
Isaac Hollander McCreeryalex-mohr
Isaac Hollander McCreery
authored andcommitted
Add flag to force pull on docker build
1 parent 2bac5f1 commit 8d01e54

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

build/common.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,9 @@ function kube::build::build_image() {
415415
kube::version::save_version_vars "${build_context_dir}/kube-version-defs"
416416

417417
cp build/build-image/Dockerfile ${build_context_dir}/Dockerfile
418-
kube::build::docker_build "${KUBE_BUILD_IMAGE}" "${build_context_dir}"
418+
# We don't want to force-pull this image because it's based on a local image
419+
# (see kube::build::build_image_cross), not upstream.
420+
kube::build::docker_build "${KUBE_BUILD_IMAGE}" "${build_context_dir}" 'false'
419421
}
420422

421423
# Build the kubernetes golang cross base image.
@@ -431,10 +433,12 @@ function kube::build::build_image_cross() {
431433
# Build a docker image from a Dockerfile.
432434
# $1 is the name of the image to build
433435
# $2 is the location of the "context" directory, with the Dockerfile at the root.
436+
# $3 is the value to set the --pull flag for docker build; true by default
434437
function kube::build::docker_build() {
435438
local -r image=$1
436439
local -r context_dir=$2
437-
local -ra build_cmd=("${DOCKER[@]}" build -t "${image}" "${context_dir}")
440+
local -r pull="${3:-true}"
441+
local -ra build_cmd=("${DOCKER[@]}" build -t "${image}" "--pull=${pull}" "${context_dir}")
438442

439443
kube::log::status "Building Docker image ${image}."
440444
local docker_output

0 commit comments

Comments
 (0)