|
|
|
load("@rules_go//go:def.bzl", "go_binary", "go_cross_binary", "go_library")
|
|
|
|
|
|
|
|
go_library(
|
|
|
|
name = "demo_lib",
|
|
|
|
srcs = ["main.go"],
|
|
|
|
importpath = "code.ndumas.com/ndumas/obsidian-markdown/cmd/demo",
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
deps = [
|
|
|
|
"//:obsidian-markdown",
|
|
|
|
"@org_uber_go_zap//zapcore",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
go_binary(
|
|
|
|
name = "base",
|
|
|
|
embed = [":demo_lib"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
platform(
|
|
|
|
name = "macos",
|
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:osx",
|
|
|
|
"@platforms//cpu:x86_64",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
platform(
|
|
|
|
name = "linux",
|
|
|
|
constraint_values = [
|
|
|
|
"@platforms//os:linux",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
go_cross_binary(
|
|
|
|
name = "darwin_binary",
|
|
|
|
platform = ":macos",
|
|
|
|
sdk_version = "1.21.0",
|
|
|
|
target = "base",
|
|
|
|
)
|
|
|
|
|
|
|
|
go_cross_binary(
|
|
|
|
name = "linux_binary",
|
|
|
|
platform = ":linux",
|
|
|
|
sdk_version = "1.21.0",
|
|
|
|
target = "base",
|
|
|
|
)
|
|
|
|
|
|
|
|
load("@rules_pkg//:pkg.bzl", "pkg_tar")
|
|
|
|
|
|
|
|
pkg_tar(
|
|
|
|
name = "tar",
|
|
|
|
srcs = [":base"],
|
|
|
|
)
|
|
|
|
|
|
|
|
load("@rules_oci//oci:defs.bzl", "oci_image")
|
|
|
|
|
|
|
|
oci_image(
|
|
|
|
name = "image",
|
|
|
|
base = "@distroless_base",
|
|
|
|
entrypoint = ["/demo"],
|
|
|
|
tars = [":tar"],
|
|
|
|
)
|