diff --git a/MODULE.bazel b/MODULE.bazel index 57e3308..4d9ba08 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,8 +5,18 @@ module( bazel_dep(name = "gazelle", version = "0.32.0") bazel_dep(name = "rules_go", version = "0.41.0") - +bazel_dep(name = "rules_oci", version = "1.3.1") +bazel_dep(name = "rules_pkg", version = "0.9.1") go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") go_deps.from_file(go_mod = "//:go.mod") use_repo(go_deps, "com_github_therealfakemoot_go_telnet") + +oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") +oci.pull( + name = "distroless_base", + image = "gcr.io/distroless/base", + tag = "latest", +) + +use_repo(oci, "distroless_base") diff --git a/cmd/echo/BUILD.bazel b/cmd/echo/BUILD.bazel index 1adf6d5..4f52043 100644 --- a/cmd/echo/BUILD.bazel +++ b/cmd/echo/BUILD.bazel @@ -12,3 +12,19 @@ go_binary( embed = [":echo_lib"], visibility = ["//visibility:public"], ) + +load("@rules_pkg//:pkg.bzl", "pkg_tar") + +pkg_tar( + name = "tar", + srcs = [":echo"], +) + +load("@rules_oci//oci:defs.bzl", "oci_image") + +oci_image( + name = "image", + base = "@distroless_base", + entrypoint = ["/echo"], + tars = [":tar"], +)