-
Notifications
You must be signed in to change notification settings - Fork 131
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
Dockerfile: reduce karmada website container image size by 28% #771
base: main
Are you sure you want to change the base?
Dockerfile: reduce karmada website container image size by 28% #771
Conversation
Signed-off-by: Mohamed Awnallah <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @mohamedawnallah! It looks like this is your first PR to karmada-io/website 🎉 |
Hi @XiShanYongYe-Chang, @zhzhuang-zju, I’ve submitted that PR and would appreciate any feedback you may have. Looking forward to your thoughts! 🙏 |
@mohamedawnallah Good job~ I'm not very good at this, but from your validation, it does look like a great optimization. With this optimization, is it possible to optimize the Karmada components images? |
Yes, I would love to optimize the Karmada components images if I see any opportunities for optimization. I'm just wondering where the Dockerfiles are located? |
you can find them in https://github.com/karmada-io/karmada/tree/master/cluster/images |
Thanks for sharing this! 🙏 I’ll take a look at them by the end of the day and submit a PR if I spot any opportunities for optimization. At first glance, I see that we could group the |
# Set environment variable | ||
ENV NODE_ENV=development | ||
# Stage 2: Development Stage. | ||
FROM alpine:latest |
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.
I understand that the final image is based on alpine:latest
, and node:18-alpine
was used before. Does it matter?
Description
This commit optimizes the Karmada website's Docker container, reducing the image size from ~796MB to ~570MB, achieving a significant ~28% reduction.
The size reduction was achieved by:
RUN
commands: Combining multipleRUN
operations to reduce intermediate tarball files generated during those operations.What type of PR is this?
/kind cleanup
Which issue(s) this PR fixes:
N/A
Special Notes for Reviewers:
Verification:
This optimization can be verified by comparing Docker image builds before and after the changes:
Further Debugging:
For deeper insights, the optimization can be analyzed using dive, a tool for exploring each layer in a Docker image.