dev-push-hyperkube.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. # Copyright 2014 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # This script will build the hyperkube image and push it to the repository
  16. # referred to by KUBE_DOCKER_REGISTRY and KUBE_DOCKER_OWNER. The image will
  17. # be given a version tag with the value from KUBE_DOCKER_VERSION.
  18. # e.g. run as:
  19. # KUBE_DOCKER_REGISTRY=localhost:5000 KUBE_DOCKER_OWNER=liyi \
  20. # KUBE_DOCKER_VERSION=1.3.0-dev ./hack/dev-push-hyperkube.sh
  21. #
  22. # will build image localhost:5000/liyi/hyperkube-amd64:1.3.0-dev
  23. set -o errexit
  24. set -o nounset
  25. set -o pipefail
  26. KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.."
  27. source "${KUBE_ROOT}/build/common.sh"
  28. if [[ -z "${KUBE_DOCKER_REGISTRY:-}" ]]; then
  29. echo "KUBE_DOCKER_REGISTRY must be set"
  30. exit -1
  31. fi
  32. if [[ -z "${KUBE_DOCKER_OWNER:-}" ]]; then
  33. echo "KUBE_DOCKER_OWNER must be set"
  34. exit -1
  35. fi
  36. if [[ -z "${KUBE_DOCKER_VERSION:-}" ]]; then
  37. echo "KUBE_DOCKER_VERSION must be set"
  38. exit -1
  39. fi
  40. kube::build::verify_prereqs
  41. kube::build::build_image
  42. kube::build::run_build_command make WHAT=cmd/hyperkube
  43. REGISTRY="${KUBE_DOCKER_REGISTRY}/${KUBE_DOCKER_OWNER}" \
  44. VERSION="${KUBE_DOCKER_VERSION}" \
  45. make -C "${KUBE_ROOT}/cluster/images/hyperkube" build
  46. docker push "${KUBE_DOCKER_REGISTRY}/${KUBE_DOCKER_OWNER}/hyperkube-amd64:${KUBE_DOCKER_VERSION}"