mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 03:33:26 +00:00
Merge pull request #1658 from proppy/slim-kube-build
build: switch to golang:1.3 and build go for KUBE_CROSSPLATFORMS
This commit is contained in:
@@ -46,6 +46,9 @@ readonly KUBE_BUILD_IMAGE_REPO=kube-build
|
||||
# KUBE_BUILD_IMAGE_TAG=<hash>
|
||||
# KUBE_BUILD_IMAGE="${KUBE_BUILD_IMAGE_REPO}:${KUBE_BUILD_IMAGE_TAG}"
|
||||
# KUBE_BUILD_CONTAINER_NAME=kube-build-<hash>
|
||||
readonly KUBE_BUILD_IMAGE_CROSS_TAG=cross
|
||||
readonly KUBE_BUILD_IMAGE_CROSS="${KUBE_BUILD_IMAGE_REPO}:${KUBE_BUILD_IMAGE_CROSS_TAG}"
|
||||
readonly KUBE_BUILD_GOLANG_VERSION=1.3
|
||||
|
||||
readonly KUBE_GO_PACKAGE="github.com/GoogleCloudPlatform/kubernetes"
|
||||
|
||||
@@ -220,10 +223,10 @@ function kube::build::build_image_built() {
|
||||
kube::build::docker_image_exists "${KUBE_BUILD_IMAGE_REPO}" "${KUBE_BUILD_IMAGE_TAG}"
|
||||
}
|
||||
|
||||
function kube::build::ensure_golang_cross() {
|
||||
kube::build::docker_image_exists golang cross || {
|
||||
function kube::build::ensure_golang() {
|
||||
kube::build::docker_image_exists golang 1.3 || {
|
||||
[[ ${KUBE_SKIP_CONFIRMATIONS} =~ ^[yY]$ ]] || {
|
||||
echo "You don't have a local copy of the golang:cross docker image. This image is 1.8GB."
|
||||
echo "You don't have a local copy of the golang docker image. This image is 450MB."
|
||||
read -p "Download it now? [y/n] " -n 1 -r
|
||||
echo
|
||||
[[ $REPLY =~ ^[yY]$ ]] || {
|
||||
@@ -232,8 +235,8 @@ function kube::build::ensure_golang_cross() {
|
||||
}
|
||||
}
|
||||
|
||||
echo "+++ Pulling docker image: golang:cross"
|
||||
docker pull golang:cross
|
||||
echo "+++ Pulling docker image: golang:${KUBE_BUILD_GOLANG_VERSION}"
|
||||
docker pull golang:${KUBE_BUILD_GOLANG_VERSION}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +258,7 @@ function kube::build::build_image() {
|
||||
third_party
|
||||
)
|
||||
|
||||
kube::build::ensure_golang_cross
|
||||
kube::build::build_image_cross
|
||||
|
||||
mkdir -p "${build_context_dir}"
|
||||
tar czf "${build_context_dir}/kube-source.tar.gz" "${source[@]}"
|
||||
@@ -266,6 +269,16 @@ EOF
|
||||
kube::build::docker_build "${KUBE_BUILD_IMAGE}" "${build_context_dir}"
|
||||
}
|
||||
|
||||
# Build the kubernetes golang cross base image.
|
||||
function kube::build::build_image_cross() {
|
||||
kube::build::ensure_golang
|
||||
|
||||
local -r build_context_dir="${LOCAL_OUTPUT_ROOT}/images/${KUBE_BUILD_IMAGE}/cross"
|
||||
mkdir -p "${build_context_dir}"
|
||||
cp build/build-image/cross/Dockerfile ${build_context_dir}/Dockerfile
|
||||
kube::build::docker_build "${KUBE_BUILD_IMAGE_CROSS}" "${build_context_dir}"
|
||||
}
|
||||
|
||||
# Builds the runtime image. Assumes that the appropriate binaries are already
|
||||
# built and in _output/build/.
|
||||
function kube::build::run_image() {
|
||||
|
Reference in New Issue
Block a user