Skip to content

Commit

Permalink
Merge pull request #71634 from ereslibre/allow-to-build-images-offline
Browse files Browse the repository at this point in the history
Allow to build docker images offline (do not always use `docker build --pull`)
  • Loading branch information
k8s-ci-robot committed Dec 5, 2018
2 parents 82cefcd + 68e6fa0 commit e689d51
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build/lib/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ readonly RELEASE_IMAGES="${LOCAL_OUTPUT_ROOT}/release-images"

KUBE_BUILD_HYPERKUBE=${KUBE_BUILD_HYPERKUBE:-y}
KUBE_BUILD_CONFORMANCE=${KUBE_BUILD_CONFORMANCE:-y}
KUBE_BUILD_PULL_LATEST_IMAGES=${KUBE_BUILD_PULL_LATEST_IMAGES:-y}

# Validate a ci version
#
Expand Down Expand Up @@ -372,7 +373,15 @@ EOF
if [[ "${base_image}" =~ busybox ]]; then
echo "COPY nsswitch.conf /etc/" >> "${docker_file_path}"
fi
"${DOCKER[@]}" build --pull -q -t "${docker_image_tag}" "${docker_build_path}" >/dev/null

# provide `--pull` argument to `docker build` if `KUBE_BUILD_PULL_LATEST_IMAGES`
# is set to y or Y; otherwise try to build the image without forcefully
# pulling the latest base image.
local -a docker_build_opts=()
if [[ "${KUBE_BUILD_PULL_LATEST_IMAGES}" =~ [yY] ]]; then
docker_build_opts+=("--pull")
fi
"${DOCKER[@]}" build "${docker_build_opts[@]}" -q -t "${docker_image_tag}" "${docker_build_path}" >/dev/null
"${DOCKER[@]}" save "${docker_image_tag}" > "${binary_dir}/${binary_name}.tar"
echo "${docker_tag}" > "${binary_dir}/${binary_name}.docker_tag"
rm -rf "${docker_build_path}"
Expand Down

0 comments on commit e689d51

Please sign in to comment.