Giter Site home page Giter Site logo

Comments (8)

ryanthecubfan avatar ryanthecubfan commented on May 26, 2024 13

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

from rules_docker.

riker09 avatar riker09 commented on May 26, 2024 8

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.

from rules_docker.

mattmoor avatar mattmoor commented on May 26, 2024 2

We're working on integrating it into a wider set of sample, you can try out: https://github.com/GoogleCloudPlatform/distroless/tree/master/examples

from rules_docker.

mattmoor avatar mattmoor commented on May 26, 2024

@dlorenc Not sure you saw this.

from rules_docker.

mattmoor avatar mattmoor commented on May 26, 2024

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.

from rules_docker.

mattmoor avatar mattmoor commented on May 26, 2024

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.

from rules_docker.

tbonza avatar tbonza commented on May 26, 2024

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

from rules_docker.

pcj avatar pcj commented on May 26, 2024

Closing due to age/inactivity.

from rules_docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.