From af34ef4c168bc874f0adec3cb9339dfd9e9fab63 Mon Sep 17 00:00:00 2001 From: Zach Loafman Date: Mon, 6 Apr 2015 09:41:14 -0700 Subject: [PATCH] Remove "-f Dockerfile.blah" from make release Rework the parallel docker build path to create separate docker build directories for each binary, rather than just separate files, eliminating the use of "-f Dockerfile.foo". (I think this also shaves a little more time off, because it was previously sending the whole dir each time to the docker daemon.) Also some minor cleanup. Fixes #6463 --- build/common.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/build/common.sh b/build/common.sh index c27c337ca6c..670e496a436 100644 --- a/build/common.sh +++ b/build/common.sh @@ -604,15 +604,20 @@ function kube::release::create_docker_images_for_server() { kube::log::status "Starting Docker build for image: ${binary_name}" ( - local docker_file_path="$1/${binary_name}.Dockerfile" + local md5_sum + md5_sum=$(kube::release::md5 "$1/${binary_name}") + + local docker_build_path="$1/${binary_name}.dockerbuild" + local docker_file_path="${docker_build_path}/Dockerfile" local binary_file_path="$1/${binary_name}" - if [ -f ${docker_file_path} ]; then - rm ${docker_file_path} - fi - printf " FROM scratch \n ADD ${binary_name} /${binary_name} \n ENTRYPOINT [ \"/${binary_name}\" ]\n" >> ${docker_file_path} - local md5_sum=$(kube::release::md5 ${binary_file_path}) + + rm -rf ${docker_build_path} + mkdir -p ${docker_build_path} + ln $1/${binary_name} ${docker_build_path}/${binary_name} + printf " FROM scratch \n ADD ${binary_name} /${binary_name} \n ENTRYPOINT [ \"/${binary_name}\" ]\n" > ${docker_file_path} + local docker_image_tag=gcr.io/google_containers/$binary_name:$md5_sum - docker build -q -f "${docker_file_path}" -t "${docker_image_tag}" ${1} >/dev/null + docker build -q -t "${docker_image_tag}" ${docker_build_path} >/dev/null docker save ${docker_image_tag} > ${1}/${binary_name}.tar echo $md5_sum > ${1}/${binary_name}.docker_tag rm ${docker_file_path}