...
1load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
2load("//hack/build/rules/container:index.bzl", "container_push", "go_oci_image")
3
4go_binary(
5 name = "backend",
6 data = [
7 ":envfile",
8 ],
9 embed = [":api_lib"],
10 visibility = ["//visibility:public"],
11)
12
13# create a filegroup to wrap the .env file, which may or may not exist
14# consumers that would use .env directly as a data dep can just reference this
15# target instead
16filegroup(
17 name = "envfile",
18 # buildifier: disable=constant-glob
19 srcs = glob([".env"]),
20 visibility = ["//visibility:public"],
21)
22
23go_oci_image(
24 name = "backend_container",
25 embed = [":api_lib"],
26 tags = ["manual"],
27)
28
29container_push(
30 name = "container_push",
31 image = ":backend_container",
32 image_name = "edge-backend",
33 repository_file = "//hack/build/rules/container:workloads-repo",
34)
35
36go_library(
37 name = "api_lib",
38 srcs = ["server.go"],
39 importpath = "edge-infra.dev/cmd/edge/api",
40 visibility = ["//visibility:private"],
41 deps = [
42 "//pkg/edge/api/graph/setup",
43 "//pkg/edge/api/types",
44 "//pkg/lib/fog",
45 "@com_github_gin_gonic_gin//:gin",
46 "@com_github_googlecloudplatform_cloudsql_proxy//proxy/dialers/postgres",
47 "@com_github_joho_godotenv//:godotenv",
48 "@com_github_peterbourgon_ff_v3//:ff",
49 ],
50)
View as plain text