Skip to content

Commit

Permalink
Parallelize Docker build as well
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerlynn committed Apr 3, 2015
1 parent 9a6e04d commit e57171d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -601,20 +601,26 @@ function kube::release::create_docker_images_for_server() {
(
local binary_name
for binary_name in "${KUBE_DOCKER_WRAPPED_BINARIES[@]}"; do
kube::log::status "Building docker image: ${binary_name}"
local docker_file_path="$1/Dockerfile"
kube::log::status "Starting Docker build for image: ${binary_name}"

(
local docker_file_path="$1/${binary_name}.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})
local docker_image_tag=gcr.io/google_containers/$binary_name:$md5_sum
docker build -q -t "${docker_image_tag}" ${1} >/dev/null
docker build -q -f "${docker_file_path}" -t "${docker_image_tag}" ${1} >/dev/null
docker save ${docker_image_tag} > ${1}/${binary_name}.tar
echo $md5_sum > ${1}/${binary_name}.docker_tag
rm ${docker_file_path}
) &
done

wait || { kube::log::error "previous Docker build failed"; return 1; }
kube::log::status "Docker builds done"
)
}

Expand Down

0 comments on commit e57171d

Please sign in to comment.