Repository navigation
Conversation
|
@htuch @yanavlasov - FYI |
|
@omriz i like the change - but can it build x-arch ? atm we use qemu and buildx to build mutl-arch containers |
|
cc @lizan |
|
Looks like this needs format checks but due to ci breakage yesterday it probably needs a main merge too, sorry for the trouble! |
|
Rebased on current master. From a quick look in the code it seems there is support for arm64 and such - the same way bazel supports it. But I think in order to generate multi arch images you'll have to execute bazel in your target arch. Will that be a reasonable approach? |
you will have to check with @lizan - but my guess/opinion is that we wouldnt want to change from buildx without the multiiarch support - adding actual builds for each arch would come at a cost, if it was possible (not sure) im wondering how difficult it would be to add buildx support upstream |
i think probably not on the basis that we dont want to force end users to install bazel when docker/compose will suffice |
|
@phlax ack. The main win of Bazel is caching when doing things at scale; you might want to think about it as examples grow and overall build time increases. It also makes things more repeatable, Docker local state might cause some pain, but we can see if there are any real issues in practice. |
|
I did some looking into the rules_docker. It doesn't actually run 'docker' in the normal sense but rather let's bazel build the layers one by one. That's why the build is reproducible. |
|
it would defo be good to hear @lizan 's take but imho... i think there are kinda 2 separate changes here
for production images this seems like a good idea - im aware tetrates getenvoy images are already built from this base. The slight problem is that for users who already depend upon the published images it would be a significant change, and may break their current environment/expectations which then opens the question of whether we would want to add another os ie ubuntu/alpine + distroless, or whether we drop one or both of the existing os images. This question is multiplied to dev and dbg versions as well as architectures.
the other change is essentially in terms of using i like the idea mostly because as bazel is used extensively already its helpful to have the docker declarations in bazel not sure about the benefits in terms of caching/layers/reproducibility. these are all broadly features of docker itself also, and besides its also not clear to me whether bazel is still passing context etc to the docker daemon to run the actual build (my guess is yes, and that its just acting as a client), in which case i think its not really that much different in terms of where things are cached/stored |
|
I think the key thing I'd like to understand is whether Bazel is handling this hermetically. Usually, Bazel does not take local system state dependencies, which is very powerful when doing things like RBE or trying to ensure that errors in build aren't due to a local snafu. If rules_docker manages hermeticity in the Bazel style, this is a clear win for reproducability of build. But, I don't really know the details on rules_docker, it would just be surprising if it broke with the rest of the Bazel ecosystem here. |
iiuc neither does docker when you build you send a hashed context to the build api if anything changes - ie hash changes - you rebuild - if it doesnt you dont whatever else bazel does im pretty confident that it doenst reimplement docker (a la podman) it just acts as a client to the docker api |
|
I see, makes sense. This then leaves the benefit of consistency and moving away from crufty shell scripts. |
yep - defo a worthy goal still 8) |
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
I would love to have |
|
@lizan can you advise on how to make the next steps on the PR? |
|
Let's make this PR into a shape, i.e. we can build x64 image on x64 and arm64 on arm64 CI. Then we still need a shell script to make it multi-arch until rules_docker support them. |
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Commit Message: Adding the ability to build a minimal docker container using bazel
Additional Description:
This is an initial example of using rules_docker to build envoy container image. This has certain benefits over the current do_ci.sh:
It is also possible to add container_push rule to add pushing the container as part of the bazel targets
Risk Level: Low
Testing: Container built and run
Docs Changes: Pending
Release Notes:
Platform Specific Features: