-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMODULE.bazel
More file actions
98 lines (82 loc) · 3.31 KB
/
MODULE.bazel
File metadata and controls
98 lines (82 loc) · 3.31 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#
# MODULE.bazel
#
# https://registry.bazel.build/
#
# Nice example of a MODULE.bazel file:
# https://github.com/aspect-build/bazel-examples/blob/main/MODULE.bazel
#
# https://fzakaria.com/2024/08/29/bazel-overlay-pattern
#
# https://github.com/llvm/llvm-project/blob/main/utils/bazel/README.md
module(
name = "go_nix_simple",
version = "0.1.0",
)
# Core Bazel dependencies
bazel_dep(name = "rules_go", version = "0.54.0") # https://github.com/bazel-contrib/rules_go/tags
bazel_dep(name = "gazelle", version = "0.43.0")
bazel_dep(name = "rules_cc", version = "0.1.1") # https://github.com/bazelbuild/rules_cc/tags
bazel_dep(name = "rules_oci", version = "2.2.6") # https://github.com/bazel-contrib/rules_oci/tags
bazel_dep(name = "rules_pkg", version = "1.1.0") # https://github.com/bazelbuild/rules_pkg/tags
#bazel_dep(name = "rules_python", version = "1.4.0") # https://github.com/bazelbuild/rules_python/tags
bazel_dep(name = "aspect_bazel_lib", version = "2.15.3") # https://registry.bazel.build/modules/aspect_bazel_lib
bazel_dep(name = "platforms", version = "0.0.11") #https://github.com/bazelbuild/platforms/tags
#bazel_dep(name = "rules_platform", version = "0.1.0") #https://github.com/bazelbuild/rules_platform/tags
bazel_dep(name = "bazel_skylib", version = "1.7.1") #https://github.com/bazelbuild/bazel-skylib/tags
bazel_dep(name = "rules_distroless", version = "0.5.1") # https://github.com/GoogleContainerTools/rules_distroless/tags
bazel_dep(name = "rules_shell", version = "0.4.1") # https://github.com/bazelbuild/rules_shell/tags
# LLVM toolchain setup
bazel_dep(name = "toolchains_llvm", version = "1.4.0") # https://github.com/bazel-contrib/toolchains_llvm/tags
# Configure LLVM toolchain
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
llvm_version = "16.0.0",
)
use_repo(llvm, "llvm_toolchain")
# use_repo(llvm, "llvm_toolchain_llvm") # if you depend on specific tools in scripts
register_toolchains("@llvm_toolchain//:all")
# Go toolchain setup
# https://github.com/bazel-contrib/rules_go/blob/master/docs/go/core/bzlmod.md#go-sdks
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(
name = "go_sdk",
version = "1.24.2",
)
use_repo(go_sdk, "go_sdk")
# Go dependencies from go.mod
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_github_clickhouse_clickhouse_go_v2",
"com_github_docker_docker",
"com_github_docker_go_connections",
"com_github_grafana_pyroscope_go",
"com_github_nats_io_nats_go",
"com_github_pkg_profile",
"com_github_prometheus_client_golang",
"com_github_prometheus_common",
"com_github_redis_go_redis_v9",
)
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
# https://github.com/GoogleContainerTools/distroless
# Distroless base images
oci.pull(
name = "distroless_static",
digest = "sha256:c0f429e16b13e583da7e5a6ec20dd656d325d88e6819cafe0adb0828976529dc",
image = "gcr.io/distroless/static-debian12",
platforms = [
"linux/amd64",
"linux/arm64",
#"linux/arm64/v8",
],
tag = "nonroot",
)
use_repo(
oci,
"distroless_static",
"distroless_static_linux_amd64",
"distroless_static_linux_arm64",
#"distroless_static_linux_arm64_v8",
)