From 3d402e6defd367ea3e3047a86451110951a4ed22 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Fri, 24 Feb 2017 17:50:23 -0800 Subject: [PATCH] unify bazel's docker build targets with other istio repos (#127) --- WORKSPACE | 8 ++++++++ docker/BUILD | 11 +++++++++++ src/envoy/mixer/BUILD | 12 ++++++++---- src/envoy/mixer/proxy_docker.bzl | 9 +++++++++ 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 docker/BUILD create mode 100644 src/envoy/mixer/proxy_docker.bzl diff --git a/WORKSPACE b/WORKSPACE index 3b255e3fa7a2..69546d288314 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -85,3 +85,11 @@ docker_build( type = "zip", url = "https://codeload.github.com/tianon/docker-brew-ubuntu-core/zip/e406914e5f648003dfe8329b512c30c9ad0d2f9c", ) + +# See github.com/istio/manager/blob/master/docker/debug/build-and-publish-debug-image.sh +# for instructions on how to re-build and publish this base image layer. +http_file( + name = "ubuntu_xenial_debug", + url = "https://storage.googleapis.com/istio-build/manager/ubuntu_xenial_debug.tar.gz", + sha256 = "02f0ea4b04012562dec4b75ee4337ac77a0003418d02a91bde1b4b4d162a41e4", +) diff --git a/docker/BUILD b/docker/BUILD new file mode 100644 index 000000000000..6e017ee60643 --- /dev/null +++ b/docker/BUILD @@ -0,0 +1,11 @@ +# Add aliases for envoy specific targets so that the docker build +# targets are consistent for all istio repos, e.g. //docker: +alias( + name = "proxy", + actual = "//src/envoy/mixer:proxy", +) + +alias( + name = "proxy_debug", + actual = "//src/envoy/mixer:proxy_debug", +) diff --git a/src/envoy/mixer/BUILD b/src/envoy/mixer/BUILD index d04b51050297..132bc364a1dd 100644 --- a/src/envoy/mixer/BUILD +++ b/src/envoy/mixer/BUILD @@ -15,8 +15,9 @@ ################################################################################ # + load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") -load("@bazel_tools//tools/build_defs/docker:docker.bzl", "docker_build") +load("//src/envoy/mixer:proxy_docker.bzl", "proxy_docker_build") load("@protobuf_git//:protobuf.bzl", "cc_proto_library") cc_proto_library( @@ -79,9 +80,11 @@ pkg_tar( tags = ["manual"], ) -docker_build( - name = "proxy", - base = "@docker_ubuntu//:xenial", +proxy_docker_build( + images = [ + {"name": "proxy", "base": "@docker_ubuntu//:xenial"}, + {"name": "proxy_debug", "base": "@ubuntu_xenial_debug//file"}, + ], entrypoint = [ "/usr/local/bin/start_envoy", "-e", @@ -99,4 +102,5 @@ docker_build( ":envoy_tar", ":start_envoy_tar", ], + visibility = ["//visibility:public"], ) diff --git a/src/envoy/mixer/proxy_docker.bzl b/src/envoy/mixer/proxy_docker.bzl new file mode 100644 index 000000000000..8522729628f2 --- /dev/null +++ b/src/envoy/mixer/proxy_docker.bzl @@ -0,0 +1,9 @@ +load("@bazel_tools//tools/build_defs/docker:docker.bzl", "docker_build") + +def proxy_docker_build(images, **kwargs): + for image in images: + docker_build( + name = image['name'], + base = image['base'], + **kwargs + )