thertweck
thertweck

Reputation: 1120

Bazel: Include runfiles in container_image

When creating Docker images using the container_image rule, necessary runfiles are not present in the image. The same is true for pkg_tar rules, which, it seems, is actually the problem.

With the following BUILD file, I would expect the sh_binary tool_b to appear in the runfiles of tool_a.

container_image(
    name = "my image",
    base = "@bash//image",
    directory = "/usr/local/opt",
    files = [":tool_a"],
)

sh_binary(
    name = "tool_a",
    visibility = ["//visibility:public"],
    srcs = ["tool_a.sh"],
    data = [":tool_b"],
)

sh_binary(
    name = "tool_b",
    visibility = ["//visibility:public"],
    srcs = ["tool_b.sh"],
)

The image however only contains tool_a.sh and the tool_a wrapper.

How can I include the runfiles, too?

Upvotes: 2

Views: 1717

Answers (1)

Benjamin Peterson
Benjamin Peterson

Reputation: 20520

Unfortunately, you can't out of the box. This is a longstanding defect in the packaging rules.

Upvotes: 1

Related Questions