-
Notifications
You must be signed in to change notification settings - Fork 8
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
Reduce Container Size #52
Reduce Container Size #52
Conversation
Minimize container size by cleaning temporary files after installing external packages
what about using a multi stage container build, so the resulting image doesn't contain Go, source files and .git? |
That's definitely something I am keen of doing for not only removing the above redundant stuff, but to decrease the enormous size of the image (around 1 GB prior to this PR cleaning). I haven't done it until now, since I have a problem of using a smaller base image and still be able to find and download the fence-agents-all package. But thinking again about it I think we can still add another base image for the purpose you have mentioned and deal with the fence-agents-all package problem afterwards (in a different PR). What is the problem? In short I wanted to use UBI base image (or it's variants, such as ubi-minimal ), after building the FAR binary and with UBI try to install fence-agents-all package. Since this package is part of HighAvailability add-on repo, then we need to enable it in UBI so it could find the desired package. Enabling is easy, but having/adding this repo is the problem. |
you can use the same image in both build steps. The final one will just not contain Go and sources / |
You are right, it did save ~640 MB, and the resulting image is ~210 MB. Still not as minimal as other Medik8s operators, but in a much better place than around 1 GB prior to this PR. |
Minimize container size by excluding Golang, source files and .git from the final image
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: razo7, slintes 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 |
Drastically minimize container size (~1GB -> ~210MB):
clean all
(see it also from container best practices-> Clean temporary files)