Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
f3b9fa62
Commit
f3b9fa62
authored
Feb 08, 2016
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push kube-cross to gcr.io
And do as much of the build setup work in it as possible.
parent
2778bc0c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
76 deletions
+58
-76
Dockerfile
build/build-image/Dockerfile
+4
-34
Dockerfile
build/build-image/cross/Dockerfile
+22
-4
Makefile
build/build-image/cross/Makefile
+26
-0
VERSION
build/build-image/cross/VERSION
+1
-0
common.sh
build/common.sh
+5
-38
No files found.
build/build-image/Dockerfile
View file @
f3b9fa62
...
@@ -13,41 +13,11 @@
...
@@ -13,41 +13,11 @@
# limitations under the License.
# limitations under the License.
# This file creates a standard build environment for building Kubernetes
# This file creates a standard build environment for building Kubernetes
FROM
gcr.io/google_containers/kube-cross:KUBE_BUILD_IMAGE_CROSS_TAG
# We replace KUBE_BUILD_IMAGE_CROSS in build/common.sh with the actual
ENV
http_proxy=KUBE_BUILD_HTTP_PROXY \
# cross-build image tag.
https_proxy=KUBE_BUILD_HTTPS_PROXY \
FROM
KUBE_BUILD_IMAGE_CROSS
no_proxy=KUBE_BUILD_NO_PROXY
MAINTAINER
Joe Beda <jbeda@google.com>
ENV
GOOS linux
ENV
GOARCH amd64
ENV
http_proxy KUBE_BUILD_HTTP_PROXY
ENV
https_proxy KUBE_BUILD_HTTPS_PROXY
ENV
no_proxy KUBE_BUILD_NO_PROXY
# work around 64MB tmpfs size in Docker 1.6
ENV
TMPDIR /tmp.k8s
# Get the code coverage tool and godep
RUN
mkdir
$TMPDIR
&&
\
go get golang.org/x/tools/cmd/cover github.com/tools/godep
# We use rsync to copy some binaries around. It is faster (0.3s vs. 1.1s) on my
# machine vs. `install`
RUN
rm
-rf
/var/lib/apt/lists/
\
&&
apt-get
-o
Acquire::Check-Valid-Until
=
false
update
\
&&
apt-get
install
-y
rsync
\
&&
rm
-rf
/var/lib/apt/lists/
# Download and symlink etcd. We need this for our integration tests.
RUN
export
ETCD_VERSION
=
v2.2.1
;
\
mkdir
-p
/usr/local/src/etcd
&&
\
cd
/usr/local/src/etcd
&&
\
curl
-fsSLO
https://github.com/coreos/etcd/releases/download/
$ETCD_VERSION
/etcd-
$ETCD_VERSION
-linux-amd64
.tar.gz
&&
\
tar
xzf etcd-
$ETCD_VERSION
-linux-amd64
.tar.gz
&&
\
ln
-s
../src/etcd/etcd-
$ETCD_VERSION
-linux-amd64
/etcd /usr/local/bin/
# Mark this as a kube-build container
# Mark this as a kube-build container
RUN
touch
/kube-build-image
RUN
touch
/kube-build-image
...
...
build/build-image/cross/Dockerfile
View file @
f3b9fa62
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
# platform go binary for the architecture kubernetes cares about.
# platform go binary for the architecture kubernetes cares about.
FROM
golang:1.4.2
FROM
golang:1.4.2
MAINTAINER
Joe Beda <jbeda@google.com>
ENV
GOARM 6
ENV
GOARM 6
ENV
KUBE_DYNAMIC_CROSSPLATFORMS \
ENV
KUBE_DYNAMIC_CROSSPLATFORMS \
...
@@ -28,11 +27,15 @@ ENV KUBE_CROSSPLATFORMS \
...
@@ -28,11 +27,15 @@ ENV KUBE_CROSSPLATFORMS \
darwin/amd64 darwin/386 \
darwin/amd64 darwin/386 \
windows/amd64 windows/386
windows/amd64 windows/386
RUN
cd
/usr/src/go/src
&&
for
platform
in
${
KUBE_CROSSPLATFORMS
}
;
do
GOOS
=
${
platform
%/*
}
GOARCH
=
${
platform
##*/
}
./make.bash
--no-clean
;
done
RUN
cd
/usr/src/go/src
\
&&
for
platform
in
${
KUBE_CROSSPLATFORMS
}
;
do
GOOS
=
${
platform
%/*
}
GOARCH
=
${
platform
##*/
}
./make.bash
--no-clean
;
done
# Install g++, then download and install protoc for generating protobuf output
# Install g++, then download and install protoc for generating protobuf output
RUN
apt-get
install
-y
g++
&&
apt-get clean
&&
rm
-rf
/var/lib/apt/lists/
*
&&
\
RUN
apt-get update
\
mkdir
-p
/usr/local/src/protobuf
&&
cd
/usr/local/src/protobuf
&&
\
&&
apt-get
install
-y
g++ rsync
\
&&
apt-get clean
&&
rm
-rf
/var/lib/apt/lists/
*
RUN
mkdir
-p
/usr/local/src/protobuf
&&
cd
/usr/local/src/protobuf
&&
\
wget
-q
https://github.com/google/protobuf/releases/download/v3.0.0-beta-2/protobuf-cpp-3.0.0-beta-2.tar.gz
&&
\
wget
-q
https://github.com/google/protobuf/releases/download/v3.0.0-beta-2/protobuf-cpp-3.0.0-beta-2.tar.gz
&&
\
tar
xzvf protobuf-cpp-3.0.0-beta-2.tar.gz
&&
\
tar
xzvf protobuf-cpp-3.0.0-beta-2.tar.gz
&&
\
cd
protobuf-3.0.0-beta-2
&&
\
cd
protobuf-3.0.0-beta-2
&&
\
...
@@ -52,3 +55,18 @@ RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.
...
@@ -52,3 +55,18 @@ RUN echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.
&&
apt-get
install
-y
build-essential
\
&&
apt-get
install
-y
build-essential
\
&&
for
platform
in
${
KUBE_DYNAMIC_CROSSPLATFORMS
}
;
do
apt-get
install
-y
crossbuild-essential-
${
platform
}
;
done
\
&&
for
platform
in
${
KUBE_DYNAMIC_CROSSPLATFORMS
}
;
do
apt-get
install
-y
crossbuild-essential-
${
platform
}
;
done
\
&&
apt-get clean
&&
rm
-rf
/var/lib/apt/lists/
*
&&
apt-get clean
&&
rm
-rf
/var/lib/apt/lists/
*
# work around 64MB tmpfs size in Docker 1.6
ENV
TMPDIR /tmp.k8s
# Get the code coverage tool and godep
RUN
mkdir
$TMPDIR
&&
\
go get golang.org/x/tools/cmd/cover github.com/tools/godep
# Download and symlink etcd. We need this for our integration tests.
RUN
export
ETCD_VERSION
=
v2.2.1
;
\
mkdir
-p
/usr/local/src/etcd
&&
\
cd
/usr/local/src/etcd
&&
\
curl
-fsSLO
https://github.com/coreos/etcd/releases/download/
$ETCD_VERSION
/etcd-
$ETCD_VERSION
-linux-amd64
.tar.gz
&&
\
tar
xzf etcd-
$ETCD_VERSION
-linux-amd64
.tar.gz
&&
\
ln
-s
../src/etcd/etcd-
$ETCD_VERSION
-linux-amd64
/etcd /usr/local/bin/
build/build-image/cross/Makefile
0 → 100644
View file @
f3b9fa62
# Copyright 2016 The Kubernetes Authors 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.
.PHONY
:
build push
IMAGE
=
kube-cross
TAG
=
$(
shell
cat
VERSION
)
build
:
docker build
-t
gcr.io/google_containers/
$(IMAGE)
:
$(TAG)
.
push
:
build
gcloud docker
--server
=
gcr.io push gcr.io/google_containers/
$(IMAGE)
:
$(TAG)
all
:
push
build/build-image/cross/VERSION
0 → 100644
View file @
f3b9fa62
v1.4.2-1
build/common.sh
View file @
f3b9fa62
...
@@ -48,10 +48,8 @@ readonly KUBE_GCS_DELETE_EXISTING="${KUBE_GCS_DELETE_EXISTING:-n}"
...
@@ -48,10 +48,8 @@ readonly KUBE_GCS_DELETE_EXISTING="${KUBE_GCS_DELETE_EXISTING:-n}"
# Constants
# Constants
readonly
KUBE_BUILD_IMAGE_REPO
=
kube-build
readonly
KUBE_BUILD_IMAGE_REPO
=
kube-build
readonly
KUBE_BUILD_GOLANG_VERSION
=
1.4.2
readonly
KUBE_BUILD_IMAGE_CROSS_TAG
=
"v1.4.2-1"
readonly
KUBE_BUILD_IMAGE_CROSS_TAG
=
"cross-
${
KUBE_BUILD_GOLANG_VERSION
}
-2"
# KUBE_BUILD_DATA_CONTAINER_NAME=kube-build-data-<hash>"
readonly
KUBE_BUILD_IMAGE_CROSS
=
"
${
KUBE_BUILD_IMAGE_REPO
}
:
${
KUBE_BUILD_IMAGE_CROSS_TAG
}
"
# KUBE_BUILD_DATA_CONTAINER_NAME=kube-build-data-<hash>
# Here we map the output directories across both the local and remote _output
# Here we map the output directories across both the local and remote _output
# directories:
# directories:
...
@@ -248,7 +246,7 @@ function kube::build::update_dockerfile() {
...
@@ -248,7 +246,7 @@ function kube::build::update_dockerfile() {
else
else
sed_opts
=(
-i
)
sed_opts
=(
-i
)
fi
fi
sed
${
sed_opts
[@]
}
"s/KUBE_BUILD_IMAGE_CROSS
/
${
KUBE_BUILD_IMAGE_CROSS
}
/"
"
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile"
sed
${
sed_opts
[@]
}
"s/KUBE_BUILD_IMAGE_CROSS
_TAG/
${
KUBE_BUILD_IMAGE_CROSS_TAG
}
/"
"
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile"
sed
${
sed_opts
[@]
}
"s#KUBE_BUILD_HTTP_PROXY#
${
KUBE_BUILD_HTTP_PROXY
:-
\
"
\"
}#"
"
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile"
sed
${
sed_opts
[@]
}
"s#KUBE_BUILD_HTTP_PROXY#
${
KUBE_BUILD_HTTP_PROXY
:-
\
"
\"
}#"
"
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile"
sed
${
sed_opts
[@]
}
"s#KUBE_BUILD_HTTPS_PROXY#
${
KUBE_BUILD_HTTPS_PROXY
:-
\
"
\"
}#"
"
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile"
sed
${
sed_opts
[@]
}
"s#KUBE_BUILD_HTTPS_PROXY#
${
KUBE_BUILD_HTTPS_PROXY
:-
\
"
\"
}#"
"
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile"
sed
${
sed_opts
[@]
}
"s#KUBE_BUILD_NO_PROXY#
${
KUBE_BUILD_NO_PROXY
:-
127
.0.0.1
}
#"
"
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile"
sed
${
sed_opts
[@]
}
"s#KUBE_BUILD_NO_PROXY#
${
KUBE_BUILD_NO_PROXY
:-
127
.0.0.1
}
#"
"
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile"
...
@@ -460,23 +458,6 @@ function kube::build::build_image_built() {
...
@@ -460,23 +458,6 @@ function kube::build::build_image_built() {
kube::build::docker_image_exists "
${
KUBE_BUILD_IMAGE_REPO
}
" "
${
KUBE_BUILD_IMAGE_TAG
}
"
kube::build::docker_image_exists "
${
KUBE_BUILD_IMAGE_REPO
}
" "
${
KUBE_BUILD_IMAGE_TAG
}
"
}
}
function kube::build::ensure_golang() {
kube::build::docker_image_exists golang "
${
KUBE_BUILD_GOLANG_VERSION
}
" || {
[[
${
KUBE_SKIP_CONFIRMATIONS
}
=~ ^[yY]
$
]] || {
echo "
You don
't have a local copy of the golang:${KUBE_BUILD_GOLANG_VERSION} docker image. This image is 450MB."
read -p "Download it now? [y/n] " -r
echo
[[ $REPLY =~ ^[yY]$ ]] || {
echo "Aborting." >&2
exit 1
}
}
kube::log::status "Pulling docker image: golang:${KUBE_BUILD_GOLANG_VERSION}"
"${DOCKER[@]}" pull golang:${KUBE_BUILD_GOLANG_VERSION}
}
}
# The set of source targets to include in the kube-build image
# The set of source targets to include in the kube-build image
function kube::build::source_targets() {
function kube::build::source_targets() {
local targets=(
local targets=(
...
@@ -512,8 +493,6 @@ function kube::build::source_targets() {
...
@@ -512,8 +493,6 @@ function kube::build::source_targets() {
function kube::build::build_image() {
function kube::build::build_image() {
kube::build::ensure_tar
kube::build::ensure_tar
kube::build::build_image_cross
mkdir -p "
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
"
mkdir -p "
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
"
"
${
TAR
}
" czf "
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/kube-source.tar.gz
"
$(
kube::build::source_targets
)
"
${
TAR
}
" czf "
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/kube-source.tar.gz
"
$(
kube::build::source_targets
)
...
@@ -523,21 +502,9 @@ function kube::build::build_image() {
...
@@ -523,21 +502,9 @@ function kube::build::build_image() {
cp build/build-image/Dockerfile "
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile
"
cp build/build-image/Dockerfile "
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
/Dockerfile
"
kube::build::update_dockerfile
kube::build::update_dockerfile
# We don'
t want to force-pull this image because it
's based on a local image
# (see kube::build::build_image_cross), not upstream.
kube::build::docker_build "
${
KUBE_BUILD_IMAGE
}
" "
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
" 'false'
kube::build::docker_build "
${
KUBE_BUILD_IMAGE
}
" "
${
LOCAL_OUTPUT_BUILD_CONTEXT
}
" 'false'
}
}
# 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}"
}
# Build a docker image from a Dockerfile.
# Build a docker image from a Dockerfile.
#
$1
is the name of the image to build
#
$1
is the name of the image to build
#
$2
is the location of the "
context
" directory, with the Dockerfile at the root.
#
$2
is the location of the "
context
" directory, with the Dockerfile at the root.
...
@@ -779,7 +746,7 @@ function kube::release::package_server_tarballs() {
...
@@ -779,7 +746,7 @@ function kube::release::package_server_tarballs() {
"
${
release_stage
}
/server/bin/
"
"
${
release_stage
}
/server/bin/
"
kube::release::create_docker_images_for_server "
${
release_stage
}
/server/bin
" "
${
arch
}
"
kube::release::create_docker_images_for_server "
${
release_stage
}
/server/bin
" "
${
arch
}
"
# Only release addon images for linux/amd64. These addon images aren't necessary for other architectures
# Only release addon images for linux/amd64. These addon images aren't necessary for other architectures
if [[
${
platform
}
== "
linux/amd64
" ]]; then
if [[
${
platform
}
== "
linux/amd64
" ]]; then
kube::release::write_addon_docker_images_for_server "
${
release_stage
}
/addons
"
kube::release::write_addon_docker_images_for_server "
${
release_stage
}
/addons
"
...
@@ -906,7 +873,7 @@ function kube::release::write_addon_docker_images_for_server() {
...
@@ -906,7 +873,7 @@ function kube::release::write_addon_docker_images_for_server() {
if [[ ! -z "
${
BUILD_PYTHON_IMAGE
:-}
" ]]; then
if [[ ! -z "
${
BUILD_PYTHON_IMAGE
:-}
" ]]; then
(
(
kube::log::status "
Building Docker python image
"
kube::log::status "
Building Docker python image
"
local img_name=python:2.7-slim-pyyaml
local img_name=python:2.7-slim-pyyaml
"
${
DOCKER
[@]
}
" build -t "
${
img_name
}
" "
${
KUBE_ROOT
}
/cluster/addons/python-image
"
"
${
DOCKER
[@]
}
" build -t "
${
img_name
}
" "
${
KUBE_ROOT
}
/cluster/addons/python-image
"
"
${
DOCKER
[@]
}
" save "
${
img_name
}
" > "
${
1
}
/
${
img_name
}
.tar
"
"
${
DOCKER
[@]
}
" save "
${
img_name
}
" > "
${
1
}
/
${
img_name
}
.tar
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment