'Deploy py_binary without container bazel
I am attempting to create a py_binary in bazel and then copy that to a remote machine. At the moment I was doing a dummy app to make sure the pipeline would work. I cannot use a docker image as I need lower level control of the hardware than docker can provide.
My goal is to do the following:
- build the software with bazel
- create a tar package that contains the py_binary
- copy and run that binary on another computer not connected to bazel
To do this I made a simple binary(that for context just makes some RPC calls to a server I am working on as a side project) and the build files is as follows:
py_binary(
    name="rosecore_cli",
    srcs=glob([
        "src/*.py"
    ]),
    deps = [
        "//rosecore/proto:project_py_pb2_grpc",
        "//rosecore/proto:project_py_pb2"
    ]
)
pkg_files(
    name = "binary",
    srcs = [
        ":rosecore_cli",
    ],
    prefix = "/usr/share/rosecore/bin",
)
pkg_filegroup(
    name = "arch",
    srcs = [
        ":binary",
    ],
    visibility = ["//visibility:public"],
)
pkg_tar(
    name = "rosecore_tar",
    srcs = [
        ":arch"
    ],
    include_runfiles=True
)
When I build, copy the tar file and extract it I get the following error:
AssertionError: Cannot find .runfiles directory for ./usr/share/rosecore/bin/rosecore_cli
Any help would be appreciated :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|
