Please update the documentation for bazel docker rules with a concrete, easy to follow live example.
I'm familiar with traditional docker-based build and as a (very) new user of bazel, I'd like to see where i can use bazel.
It'd help if we update our docs with a 'concrete' example: eg. suggest a full end to end example that runs alpine with python and then simply echo python -c 'print "hello world"' or some such; (something i can run off the bat)
We're working on integrating it into a wider set of sample, you can try out: https://github.com/GoogleCloudPlatform/distroless/tree/master/examples
@dlorenc Not sure you saw this.
Just to post back here. My goal is to move towards a model where users learn to write their foo_binary rule (e.g. go_binary, cc_binary, java_binary, ...), they can then swap in one of the new foo_image rules, which have identical signature to their foo_binary counterparts.
I expect this would cover a significant percentage of folks who just want their application to run in a container in an appropriate target environment.
I still think we want/need samples, including for both foo_image and cases where folks want to graduate beyond foo_image to do more sophisticated things those don't easily allow.
I have an example that use the foo_image rules (which wraps docker_build + distroless) in a number of languages to implement a GRPC service that deploys to Kubernetes here.
For trying out Bazel, I'm having a hard time finding the kind of example that is docker specific - Something prescriptive for going from current state (Dockerfile, script that runs docker build and docker push) to desired state (no more docker engine, use Bazel instead). Unfortunately, the docs and examples I've been able to find so far are either language specific (build Golang binary, build docker image from that) or incomplete (they show a few bits and pieces, but nothing end to end). Maybe I'm just looking in the wrong place, but trying to evaluate whether we can migrate from bash+docker to Bazel is frustrating. I concerned that I'll have to go all-in on understanding Bazel in order to understand how to do what I view as what should be a fairly straightforward use case.
Are there any nontrivial, "here's a dockerfile, here's the equivalent BUILD file" examples? The closest I could find was this old post that doesn't work for me: https://blog.bazel.build/2015/07/28/docker_build.html
Here we are, a year later, and I'm facing exactly the same issue that @ryanthecubfan is. I really like to get started with using Bazel in my polyglot monorepo but man, Bazel is hard if you've never used a build system before.
Ran into this problem as well when using cc_image. Following the current README instructions, I couldn't figure out where the C++ binary was being placed. After getting some help on the Slack channel and reviewing https://github.com/bazelbuild/rules_docker/blob/master/lang/image.bzl#L267,
I found my binary under /app/main/narr where my cc_binary would normally be written under bazel-bin/main/narr. This isn't the best tutorial but hopefully sharing my experience can help move things along
Closing due to age/inactivity.
Most helpful comment
For trying out Bazel, I'm having a hard time finding the kind of example that is docker specific - Something prescriptive for going from current state (Dockerfile, script that runs docker build and docker push) to desired state (no more docker engine, use Bazel instead). Unfortunately, the docs and examples I've been able to find so far are either language specific (build Golang binary, build docker image from that) or incomplete (they show a few bits and pieces, but nothing end to end). Maybe I'm just looking in the wrong place, but trying to evaluate whether we can migrate from bash+docker to Bazel is frustrating. I concerned that I'll have to go all-in on understanding Bazel in order to understand how to do what I view as what should be a fairly straightforward use case.
Are there any nontrivial, "here's a dockerfile, here's the equivalent BUILD file" examples? The closest I could find was this old post that doesn't work for me: https://blog.bazel.build/2015/07/28/docker_build.html