rules_ruby
rules_ruby copied to clipboard
Clarification - using generated ruby_binary in container image
Hey - I'm a bazel noob, so apologies for the question, but I'm trying to produce a container image with my rails project using these rules and I'm stuck.
I have a ruby_binary
package in my BUILD
(largely cribbed from the examples/simple_rails_api
dir) which builds successfully. But I'm then coming up dry getting that into a runnable container. I've looked at py_binary
for inspiration, but there seems to be a py_image
(https://github.com/bazelbuild/rules_docker#py_image) rules_docker
rule that does the work for that. How can I go about doing it with container_layer
and container_image
rules? Is the idea that the ruby_binary
produces a binary that requires no other deps?
Ruby binary most definitely will need dependencies.
It's possible we would have to implement a similar to Python rule ruby_image
to build docker image with all the dependencies.
You may be able to do the packaging of all dependencies using a genrule
that executes a shell script to create a dockerfile in the root of runfiles for your target and build the container there.
To be honest i am not super familiar with the container rules.
I'd suggest you examine the runfiles folder for your binary target to see the layout. It should contain symlinks to all the dependencies.