-
Notifications
You must be signed in to change notification settings - Fork 206
Description
Context
I have a web server written in Go. I have a folder of html template files as data dependencies in a go_library target, i.e.
file_group = (
name = "my_templates",
srcs = ["path/to/my/.html"],
)
go_library = (
...
data = [":my_templates"]
)
I am currently using rules_docker which correctly preserves the folder structure of runfiles that my Go code relies to serve the html templates.
Since rules_docker is now deprecated I am trying to migrate to rule_oci and thus pkg_tar in rules_pkg.
The problem
With pkg_tar, the data dependencies no longer reside in the same folder as layered out by bazel build. Instead every file is flatten into the root directory.
I thought v0.10.0 would solve the problem judging from #579. But seems like it only does so for Python?
For my Go project setup,
go_library(
name = "server_lib",
srcs = ["main.go"],
...
)
go_binary(
name = "server",
embed = [":server_lib"],
...
)
pkg_tar(
name = "server-tar",
srcs = [":server"],
include_runfiles = True,
)
oci_image(
name = "server-image",
base = "@distroless_base",
entrypoint = ["/server"],
tars = [":server-tar"],
)
After bazel build :server the runfiles lie in bazel-bin/server_/server.runfiles/_main/.
#579 (comment) describes exactly what rules_docker does and what I need.