-
Notifications
You must be signed in to change notification settings - Fork 10
/
BUILD.bazel
83 lines (74 loc) · 2.24 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push", "oci_tarball", "oci_image_index")
load("@bazel_gazelle//:def.bzl", "gazelle")
gazelle(name = "gazelle")
go_binary(
name = "main",
out = "grpc_health_proxy",
embed = [":cmd_lib"],
visibility = ["//visibility:public"],
goos = "linux",
goarch = "amd64",
)
go_library(
name = "cmd_lib",
srcs = [
"main.go",
],
visibility = ["//visibility:private"],
deps = [
"@com_github_golang_glog//:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//credentials:go_default_library",
"@org_golang_google_grpc//credentials/insecure:go_default_library",
"@org_golang_google_grpc//health/grpc_health_v1:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@org_golang_x_net//http2:go_default_library",
"@com_github_gorilla_mux//:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
"@com_github_prometheus_client_golang//prometheus/promhttp:go_default_library",
],
)
pkg_tar(
name = "app-tar",
srcs = [":main"],
package_dir = "/",
)
oci_image(
name = "server-image",
base = "@distroless_base",
tars = [":app-tar"],
entrypoint = ["/grpc_health_proxy"],
cmd = [],
env = {},
exposed_ports = [
"8080/tcp",
],
)
oci_tarball(
name = "tar-docker",
image = "server-image",
format = "docker",
repo_tags = ["index.docker.io/salrashid123/grpc_health_proxy"],
)
oci_image_index(
name = "app-index",
images = [
":server-image",
]
)
oci_tarball(
name = "tar-oci-index",
image = ":app-index",
format = "oci",
repo_tags = ["index.docker.io/salrashid123/grpc_health_proxy"],
)
oci_push(
name = "push-image",
image = ":server-image",
repository = "index.docker.io/salrashid123/grpc_health_proxy",
remote_tags = ["latest"]
)