-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Refactor Dockerfile: Add Optimizations for Building Dependencies in Dockerfile #16149
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
base: develop
Are you sure you want to change the base?
Conversation
Adding optimization for Building Dependencies
Thank you for your contribution to the Solidity compiler! A team member will follow up shortly. If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother. If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix. |
Thanks for the effort! However, since this is a multi-stage build, the APK cache cleanup in the build stage doesn't affect the final image, the entire build stage gets discarded and the final image is built |
RUN apk update && \ | ||
apk add --no-cache --no-install-recommends \ | ||
boost-dev \ | ||
boost-static \ | ||
build-base \ | ||
cmake \ | ||
git \ | ||
clang && \ | ||
rm -rf /var/cache/apk/* |
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.
If we're at refactoring the Dockerfiles, I'll just add that I'd prefer if we eventually switched to this style for multi-command RUN
:
RUN apk update && \ | |
apk add --no-cache --no-install-recommends \ | |
boost-dev \ | |
boost-static \ | |
build-base \ | |
cmake \ | |
git \ | |
clang && \ | |
rm -rf /var/cache/apk/* | |
RUN <<-EOF | |
set -eou pipefail | |
apk update | |
apk add --no-install-recommends \ | |
boost-dev \ | |
boost-static \ | |
build-base \ | |
cmake \ | |
git \ | |
clang | |
rm -rf /var/cache/apk/* | |
EOF |
It has less noise from continuations and &&
and does not require changing the snippet when it is moved to/from an .sh
file.
Adding optimization for Building Dependencies
Clean up package cache after install
Effect: