2017-02-01 00:45:59 +00:00
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2017-02-03 13:41:32 +00:00
|
|
|
load("@io_bazel//tools/build_defs/docker:docker.bzl", "docker_build")
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "package-srcs",
|
|
|
|
srcs = glob(["**"]),
|
|
|
|
tags = ["automanaged"],
|
|
|
|
)
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "all-srcs",
|
|
|
|
srcs = [
|
|
|
|
":package-srcs",
|
|
|
|
"//build/debs:all-srcs",
|
|
|
|
"//build/release-tars:all-srcs",
|
|
|
|
],
|
|
|
|
tags = ["automanaged"],
|
|
|
|
)
|
2017-02-01 00:45:59 +00:00
|
|
|
|
|
|
|
docker_build(
|
|
|
|
name = "busybox",
|
|
|
|
debs = [
|
|
|
|
"@busybox_deb//file",
|
|
|
|
],
|
|
|
|
symlinks = {
|
|
|
|
"/bin/sh": "/bin/busybox",
|
|
|
|
"/usr/bin/busybox": "/bin/busybox",
|
|
|
|
"/usr/sbin/busybox": "/bin/busybox",
|
|
|
|
"/sbin/busybox": "/bin/busybox",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
docker_build(
|
|
|
|
name = "busybox-libc",
|
|
|
|
base = ":busybox",
|
|
|
|
debs = [
|
|
|
|
"@libc_deb//file",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
docker_build(
|
|
|
|
name = "busybox-net",
|
|
|
|
base = ":busybox-libc",
|
|
|
|
debs = [
|
|
|
|
"@iptables_deb//file",
|
|
|
|
"@iproute2_deb//file",
|
|
|
|
"@libnetlink_deb//file",
|
|
|
|
"@libxtables_deb//file",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2017-02-03 13:41:32 +00:00
|
|
|
DOCKERIZED_BINARIES = {
|
|
|
|
"kube-apiserver": {
|
|
|
|
"base": ":busybox-libc",
|
|
|
|
"target": "//cmd/kube-apiserver:kube-apiserver",
|
|
|
|
},
|
|
|
|
"kube-controller-manager": {
|
|
|
|
"base": ":busybox-libc",
|
|
|
|
"target": "//cmd/kube-controller-manager:kube-controller-manager",
|
|
|
|
},
|
|
|
|
"kube-scheduler": {
|
|
|
|
"base": ":busybox-libc",
|
|
|
|
"target": "//plugin/cmd/kube-scheduler:kube-scheduler",
|
|
|
|
},
|
|
|
|
"kube-aggregator": {
|
|
|
|
"base": ":busybox-libc",
|
|
|
|
"target": "//cmd/kube-aggregator:kube-aggregator",
|
|
|
|
},
|
|
|
|
"kube-proxy": {
|
|
|
|
"base": ":busybox-net",
|
|
|
|
"target": "//cmd/kube-proxy:kube-proxy",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
[genrule(
|
|
|
|
name = binary + "_docker_tag",
|
|
|
|
srcs = [meta["target"]],
|
|
|
|
outs = [binary + ".docker_tag"],
|
|
|
|
# Currently each target has two outputs, the binary and its library, so hash only the first item (the binary).
|
|
|
|
# This can be made less hacky when we have static linking working.
|
|
|
|
cmd = "md5sum $(locations " + meta["target"] + ") | grep '" + binary + "'$$ | cut -f1 -d' ' | tr -d '\n' > $@",
|
|
|
|
) for binary, meta in DOCKERIZED_BINARIES.items()]
|
|
|
|
|
2017-02-01 00:45:59 +00:00
|
|
|
[docker_build(
|
|
|
|
name = binary,
|
2017-02-03 13:41:32 +00:00
|
|
|
base = meta["base"],
|
2017-02-01 00:45:59 +00:00
|
|
|
cmd = ["/usr/bin/" + binary],
|
|
|
|
debs = [
|
|
|
|
"//build/debs:%s.deb" % binary,
|
|
|
|
],
|
2017-02-03 13:41:32 +00:00
|
|
|
image_tags = [
|
|
|
|
"@%s.docker_tag" % binary,
|
2017-02-01 00:45:59 +00:00
|
|
|
],
|
2017-02-03 13:41:32 +00:00
|
|
|
repository = "gcr.io/google_containers/" + binary,
|
|
|
|
repository_append_package = False,
|
|
|
|
symlinks = {
|
|
|
|
# Some cluster startup scripts expect to find the binaries in /usr/local/bin,
|
|
|
|
# but the debs install the binaries into /usr/bin.
|
|
|
|
"/usr/local/bin/" + binary: "/usr/bin/" + binary,
|
|
|
|
},
|
|
|
|
) for binary, meta in DOCKERIZED_BINARIES.items()]
|
2017-02-01 00:45:59 +00:00
|
|
|
|
|
|
|
filegroup(
|
2017-02-03 13:41:32 +00:00
|
|
|
name = "docker-artifacts",
|
|
|
|
srcs = [":%s.tar" % binary for binary in DOCKERIZED_BINARIES.keys()] +
|
|
|
|
[":%s.docker_tag" % binary for binary in DOCKERIZED_BINARIES.keys()],
|
2017-02-01 00:45:59 +00:00
|
|
|
)
|