bazel: statically link dockerized components

and remove libc from docker images when it's not needed.
pull/6/head
Mike Danese 2017-04-11 10:22:17 -07:00
parent 55042b0ba9
commit 3757e8bb5c
9 changed files with 54 additions and 11 deletions

View File

@ -32,17 +32,10 @@ docker_build(
)
docker_build(
name = "busybox-libc",
name = "busybox-net",
base = ":busybox",
debs = [
"@libc_deb//file",
],
)
docker_build(
name = "busybox-net",
base = ":busybox-libc",
debs = [
"@iptables_deb//file",
"@iproute2_deb//file",
"@libnetlink_deb//file",
@ -52,15 +45,15 @@ docker_build(
DOCKERIZED_BINARIES = {
"kube-apiserver": {
"base": ":busybox-libc",
"base": ":busybox",
"target": "//cmd/kube-apiserver:kube-apiserver",
},
"kube-controller-manager": {
"base": ":busybox-libc",
"base": ":busybox",
"target": "//cmd/kube-controller-manager:kube-controller-manager",
},
"kube-scheduler": {
"base": ":busybox-libc",
"base": ":busybox",
"target": "//plugin/cmd/kube-scheduler:kube-scheduler",
},
"kube-proxy": {

View File

@ -10,7 +10,14 @@ load(
go_binary(
name = "cloud-controller-manager",
gc_linkopts = [
"-linkmode",
"external",
"-extldflags",
"-static",
],
library = ":go_default_library",
linkstamp = "k8s.io/kubernetes/pkg/version",
tags = ["automanaged"],
)

View File

@ -10,6 +10,12 @@ load(
go_binary(
name = "kube-apiserver",
gc_linkopts = [
"-linkmode",
"external",
"-extldflags",
"-static",
],
library = ":go_default_library",
linkstamp = "k8s.io/kubernetes/pkg/version",
tags = ["automanaged"],

View File

@ -10,6 +10,12 @@ load(
go_binary(
name = "kube-controller-manager",
gc_linkopts = [
"-linkmode",
"external",
"-extldflags",
"-static",
],
library = ":go_default_library",
linkstamp = "k8s.io/kubernetes/pkg/version",
tags = ["automanaged"],

View File

@ -10,6 +10,12 @@ load(
go_binary(
name = "kube-proxy",
gc_linkopts = [
"-linkmode",
"external",
"-extldflags",
"-static",
],
library = ":go_default_library",
linkstamp = "k8s.io/kubernetes/pkg/version",
tags = ["automanaged"],

View File

@ -10,6 +10,12 @@ load(
go_binary(
name = "kubeadm",
gc_linkopts = [
"-linkmode",
"external",
"-extldflags",
"-static",
],
library = ":go_default_library",
linkstamp = "k8s.io/kubernetes/pkg/version",
tags = ["automanaged"],

View File

@ -10,6 +10,12 @@ load(
go_binary(
name = "kubectl",
gc_linkopts = [
"-linkmode",
"external",
"-extldflags",
"-static",
],
library = ":go_default_library",
linkstamp = "k8s.io/kubernetes/pkg/version",
tags = ["automanaged"],

View File

@ -10,6 +10,12 @@ load(
go_binary(
name = "kube-scheduler",
gc_linkopts = [
"-linkmode",
"external",
"-extldflags",
"-static",
],
library = ":go_default_library",
linkstamp = "k8s.io/kubernetes/pkg/version",
tags = ["automanaged"],

View File

@ -10,7 +10,14 @@ load(
go_binary(
name = "kube-aggregator",
gc_linkopts = [
"-linkmode",
"external",
"-extldflags",
"-static",
],
library = ":go_default_library",
linkstamp = "k8s.io/kubernetes/pkg/version",
tags = ["automanaged"],
)