From 521f145fb5fee1632fad0e787e086b6c15be367e Mon Sep 17 00:00:00 2001 From: Johan Euphrosine Date: Wed, 8 Oct 2014 12:52:56 -0700 Subject: [PATCH 1/4] build: switch to golang:1.3 and build go for KUBE_CROSSPLATFORMS --- build/build-image/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/build-image/Dockerfile b/build/build-image/Dockerfile index 631eade71f0..4ff8066b98c 100644 --- a/build/build-image/Dockerfile +++ b/build/build-image/Dockerfile @@ -14,12 +14,15 @@ # This file creates a standard build environment for building Kubernetes -FROM golang:cross +FROM golang:1.3 MAINTAINER Joe Beda ENV KUBE_CROSSPLATFORMS \ linux/386 linux/arm \ darwin/amd64 darwin/386 + +RUN cd /usr/src/go/src && for platform in ${KUBE_CROSSPLATFORMS}; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean; done + # (set an explicit GOARM of 5 for maximum compatibility) ENV GOARM 5 ENV GOOS linux From 6452b0fe973e9fa64a526c4d46701f7b01759276 Mon Sep 17 00:00:00 2001 From: Johan Euphrosine Date: Tue, 21 Oct 2014 15:13:14 -0700 Subject: [PATCH 2/4] build: add kube-build:cross base --- build/build-image/Dockerfile | 8 +------- build/build-image/cross/Dockerfile | 25 +++++++++++++++++++++++++ build/common.sh | 22 +++++++++++++++++----- 3 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 build/build-image/cross/Dockerfile diff --git a/build/build-image/Dockerfile b/build/build-image/Dockerfile index 4ff8066b98c..3d9e58cfa24 100644 --- a/build/build-image/Dockerfile +++ b/build/build-image/Dockerfile @@ -14,15 +14,9 @@ # This file creates a standard build environment for building Kubernetes -FROM golang:1.3 +FROM kube-build:cross MAINTAINER Joe Beda -ENV KUBE_CROSSPLATFORMS \ - linux/386 linux/arm \ - darwin/amd64 darwin/386 - -RUN cd /usr/src/go/src && for platform in ${KUBE_CROSSPLATFORMS}; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean; done - # (set an explicit GOARM of 5 for maximum compatibility) ENV GOARM 5 ENV GOOS linux diff --git a/build/build-image/cross/Dockerfile b/build/build-image/cross/Dockerfile new file mode 100644 index 00000000000..926da0148a4 --- /dev/null +++ b/build/build-image/cross/Dockerfile @@ -0,0 +1,25 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file creates a standard build environment for building cross +# platform go binary for the architecture kubernetes cares about. + +FROM golang:1.3 +MAINTAINER Joe Beda + +ENV KUBE_CROSSPLATFORMS \ + linux/386 linux/arm \ + darwin/amd64 darwin/386 + +RUN cd /usr/src/go/src && for platform in ${KUBE_CROSSPLATFORMS}; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean; done diff --git a/build/common.sh b/build/common.sh index 15a9189f8b6..7a368f09a66 100644 --- a/build/common.sh +++ b/build/common.sh @@ -46,6 +46,8 @@ readonly KUBE_BUILD_IMAGE_REPO=kube-build # KUBE_BUILD_IMAGE_TAG= # KUBE_BUILD_IMAGE="${KUBE_BUILD_IMAGE_REPO}:${KUBE_BUILD_IMAGE_TAG}" # KUBE_BUILD_CONTAINER_NAME=kube-build- +readonly KUBE_BUILD_IMAGE_CROSS_TAG=cross +readonly KUBE_BUILD_IMAGE_CROSS="${KUBE_BUILD_IMAGE_REPO}:${KUBE_BUILD_IMAGE_CROSS_TAG}" readonly KUBE_GO_PACKAGE="github.com/GoogleCloudPlatform/kubernetes" @@ -220,8 +222,8 @@ 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." read -p "Download it now? [y/n] " -n 1 -r @@ -232,8 +234,8 @@ function kube::build::ensure_golang_cross() { } } - echo "+++ Pulling docker image: golang:cross" - docker pull golang:cross + echo "+++ Pulling docker image: golang:1.3" + docker pull golang:1.3 } } @@ -255,7 +257,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 +268,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() { From d5e7ddb428f5011aed44291c72d5403d1ff280b9 Mon Sep 17 00:00:00 2001 From: Johan Euphrosine Date: Tue, 21 Oct 2014 15:24:36 -0700 Subject: [PATCH 3/4] build: fix golang pull message --- build/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.sh b/build/common.sh index 7a368f09a66..d6a07523830 100644 --- a/build/common.sh +++ b/build/common.sh @@ -225,7 +225,7 @@ function kube::build::build_image_built() { 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 450GB." read -p "Download it now? [y/n] " -n 1 -r echo [[ $REPLY =~ ^[yY]$ ]] || { From 29c4fd6bb3dfc3531edf1e60e1af75073d800fdb Mon Sep 17 00:00:00 2001 From: Johan Euphrosine Date: Wed, 22 Oct 2014 16:52:20 -0700 Subject: [PATCH 4/4] build: add KUBE_BUILD_GOLANG_VERSION --- build/common.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build/common.sh b/build/common.sh index d6a07523830..327d4e210d7 100644 --- a/build/common.sh +++ b/build/common.sh @@ -48,6 +48,7 @@ readonly KUBE_BUILD_IMAGE_REPO=kube-build # KUBE_BUILD_CONTAINER_NAME=kube-build- 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" @@ -225,7 +226,7 @@ function kube::build::build_image_built() { 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 docker image. This image is 450GB." + 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]$ ]] || { @@ -234,8 +235,8 @@ function kube::build::ensure_golang() { } } - echo "+++ Pulling docker image: golang:1.3" - docker pull golang:1.3 + echo "+++ Pulling docker image: golang:${KUBE_BUILD_GOLANG_VERSION}" + docker pull golang:${KUBE_BUILD_GOLANG_VERSION} } }