about summary refs log tree commit diff
path: root/src/rest-api/cmd/BUILD.bazel
blob: 4ecded7f0536efd7d31c44817da6c1e0eacb4a53 (plain) (blame)
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
load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_cross_binary", "go_library")
load("@rules_helm//helm:defs.bzl", "helm_chart")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push", "oci_tarball")
load("@rules_pkg//:pkg.bzl", "pkg_tar")

go_library(
    name = "cmd_lib",
    srcs = ["main.go"],
    importpath = "github.com/Baitinq/fs-tracer-backend/src/rest-api/cmd",
    visibility = ["//visibility:private"],
    deps = [
        "//src/rest-api/handler",
        "@com_github_segmentio_kafka_go//:kafka-go",
        "@com_github_segmentio_kafka_go//sasl/plain",
    ],
)

go_binary(
    name = "cmd",
    embed = [":cmd_lib"],
    visibility = ["//visibility:public"],
)

go_cross_binary(
    name = "cmd_arm64",
    platform = "@io_bazel_rules_go//go/toolchain:linux_arm64",
    target = ":cmd",
    visibility = ["//visibility:public"],
)

pkg_tar(
    name = "tar",
    srcs = [":cmd_arm64"],
)

oci_image(
    name = "image",
    base = "@distroless_base",
    entrypoint = ["/cmd_arm64"],
    # architecture = "arm64",
    # os = "linux",
    tars = [":tar"],
)

oci_tarball(
    name = "tarball",
    image = ":image",
    repo_tags = [],
)

expand_template(
    name = "stamped",
    out = "_stamped.tags.txt",
    stamp = 1,
    stamp_substitutions = {"tag": "rest-api-{{STABLE_GIT_SHA}}"},
    template = ["tag"],
)

oci_push(
    name = "push",
    image = ":image",
    remote_tags = ":stamped",
    repository = "docker.io/baitinq/fs-tracer",
    visibility = ["//visibility:public"],
)