-
Notifications
You must be signed in to change notification settings - Fork 55
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
fix: fix Makefile and Dockerfile for idempotent images and to support multi-arch builds Fixes RHOAIENG-12078 #322
fix: fix Makefile and Dockerfile for idempotent images and to support multi-arch builds Fixes RHOAIENG-12078 #322
Conversation
I'll continue on cleaning it up for multi-arch build support tomorrow. There is something interesting happening though. Try editing model-registry.yaml to add a new endpoint (duplicate the first path with a different path and operationId) and see the behavior. |
The |
d9af014
to
c3f4f5a
Compare
I can use regular expressions for extracting and sorting the functions to fix this. I'll add that tomorrow. |
03d0237
to
27a1dcf
Compare
Made gen_type_assert.sh idempotent. I'll add docker env variables for multi-platform builds and a makefile target next. |
@tarilabs @isinyaaa you can try out multi-platform builds using a command similar to: IMG_ORG=dhirajsb make image/buildx This command built and pushed images to my dockerhub repo https://hub.docker.com/r/dhirajsb/model-registry/tags Give it a try and let me know what happens on other platforms. |
As an experiment, I built the project in different ways and on my admittedly beefy laptop I saw the following build times:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much @dhirajsb , output as requested:
[+] Building 314.4s (86/86) FINISHED docker-container:model-registry-builder
Appreciate ordering in the type asserts file generation too!
We will need a way to test these, possibly by leveraging the e2e as mentioned before wiring it as the shipped images, but this is great progress imho and many thanks again!
🚀
/lgtm
@tarilabs is this supposed to auto-merge after your lgtm? |
I haven't been able to run
when I list the commands, however, there's not even a |
@isinyaaa podman doesn't support the same options for buildx. I'm testing a change locally to fix that. |
08b782b
to
e43d21f
Compare
I added podman support for using buildx. But unfortunately there is no command parity. And, the podman buildx build also seems to run in a very un-optimized fashion. @isinyaaa test it and let us know. |
I was able to test with docker and podman on mac using: make image/buildx and DOCKER=podman make image/buildx respectively. Can report it worked fine, although I've lost track of the running times because I had to reboot. |
# architectures. (i.e. make docker-buildx). To use this option you need to: | ||
# - be able to use docker buildx. More info: https://docs.docker.com/build/buildx/ | ||
# - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/ | ||
# - be able to push the image to your registry (i.e. if you do not set a valid value via IMG=<myregistry/image:<tag>> then the export will fail) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we make a separate rule for pushing? we're not only building for that purpose AFAIK, but also to be able to have those images locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker doesn't support that, it doesn't keep manifests locally and have to be pushed to a registry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC it does cache results, but they're not exported to docker by default.
To do that, you can use --load
on the build cmd.
I'm not sure if you can push it subsequently at no cost though, or if you have to build again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are open issues with --load
and it didn't work for me. Multi-platform builds are useful for publishing to remote repos, not as much for local use.
E.g. we'll do it in CI on PR merge and not for pulls.
strangely, I'm also not able to build again:
|
The rebuild error sounds like the docker |
Signed-off-by: Dhiraj Bokde <dhirajsb@users.noreply.github.com>
fix gen/openapi-server make target to generate go-server if model-registry.yaml file is newer Signed-off-by: Dhiraj Bokde <dhirajsb@users.noreply.github.com>
Signed-off-by: Dhiraj Bokde <dhirajsb@users.noreply.github.com>
… to type_asserts.go Signed-off-by: Dhiraj Bokde <dhirajsb@users.noreply.github.com>
…s using docker buildx, split 'build' target into 'build/prepare' and 'build/compile' to optimize multi-platform builds Signed-off-by: Dhiraj Bokde <dhirajsb@users.noreply.github.com>
…tion, optimize build steps Signed-off-by: Dhiraj Bokde <dhirajsb@users.noreply.github.com>
Signed-off-by: Dhiraj Bokde <dhirajsb@users.noreply.github.com>
bf67a92
to
1edf825
Compare
Signed-off-by: Dhiraj Bokde <dhirajsb@users.noreply.github.com>
1edf825
to
83e9c87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: isinyaaa, tarilabs The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
Cleanup Makefile and Dockerfile to make them reproducable
Add multi-arch platform builds
How Has This Been Tested?
CI will verify Makefile and Dockerfile changes
Dockerfile changes can be tested locally by updating model-registry.yaml
Merge criteria:
DCO
check)If you have UI changes