New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker build rule doesn't work at the top level #616
Comments
workaround by specifying the tag: I am unsure of a correct solution for that. |
How about adding a "custom_repository_name" attribute so user can specify arbitrary repository names? Not only for this scenario, but also for other use cases in which the generated repository names might contain more than two levels while the docker registry supports only two levels, such as: goharbor/harbor#1179. If it's acceptable, I'd volunteer to implement it. |
Here is a draft impl: linuxerwang@ebd5d66 |
@linuxerwang: Why not simply use the |
Your draft impl is actually changing the image name, not the repository part. |
You are right, Damien, I meant to make the image name customizable, not the repository. Code updated: linuxerwang@320e725 Thanks! |
Sorry for the delay, holidays... The code looks good, it would be accepted as a PR I think. /cc @mattmoor: fyi there is still plenty of issue on docker_build on the bazel repo |
Hmm, @damienmg I thought this was fixed a while ago, but I guess not. For custom naming in general, folks should use |
@mattmoor I didn't get how to use docker_bundle to customize naming, could you please provide an example? Also, it'd be quite cumbersome to define another target just to get the image name right, since we have lots of such places. I feel docker_bundle is design to help combining images rather than naming purpose. The os.path.join() trick has been applied: #2807 Thanks. |
Left a couple comments on the PR. In principle, yes it is intended for bundling several images, to just alias it you'd write:
I wasn't suggesting aliasing would fix this issue, ultimately I think If you do in fact want aliasing throughout your codebase of |
@mattmoor Thanks, I get it now. The reason why we have to customize the image names a lot is because our folder structure is as follows:
such that the generated image name would be: registry.com/project/cmd/command1 which has 3 levels of folders. But the docker registry we are using (https://github.com/vmware/harbor) only supports 2 levels. Another reason is that historicly some of the binaries/images disperse to different projects, but we want to name them with common prefix, such as payment/service and payment/queue (just demo names). The "service" and "queue" are under different projects but we want both have the same prefix "payment". Code updated. PTAL. |
FWIW, I'd like to separate the discussion of aliasing the built images from a fix for this particular issue. I think we can close this issue by changing two lines to use I'll open another issue where we can discuss aliasing. |
Code updated with only the two lines change. PTAL. |
If I have a docker build rule at the top level of a bazel workspace the generated script for loading it in to local docker repository doesn't work. This is because the tag generated for the image is rejected by docker because it has an empty name section.
BUILD rule
The text was updated successfully, but these errors were encountered: