-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathBUILD.bazel
47 lines (41 loc) · 1.14 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
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_prefix")
go_prefix("github.com/kelseyhightower/hello-universe")
go_library(
name = "go_default_library",
srcs = [
"handler.go",
"main.go",
"version.go",
],
visibility = ["//visibility:private"],
deps = ["@com_github_kelseyhightower_kargo//:go_default_library"],
)
go_binary(
name = "hello-universe",
library = ":go_default_library",
visibility = ["//visibility:public"],
)
load(
"@io_bazel_rules_docker//docker:docker.bzl",
"docker_build", "docker_push",
)
# I put the Go binary into a Docker image.
# Load me into the Docker daemon with `bazel run :image`
# Produce a tarball compatible with `docker load` via:
# bazel build :image.tar
docker_build(
name = "image",
base = "@base//image",
files = [":hello-universe"],
entrypoint = ["/hello-universe"],
)
# I publish the docker image to the specified registry,
# when you `bazel run :push`
docker_push(
name = "push",
image = ":image",
registry = "gcr.io",
repository = "your-project/hello-universe",
tag = "{BUILD_USER}",
stamp = True,
)