-
-
Notifications
You must be signed in to change notification settings - Fork 445
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
dnf clean
after dnf install
in Dockerfiles
#948
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #948 +/- ##
=======================================
Coverage 99.52% 99.52%
=======================================
Files 123 123
Lines 16353 16353
Branches 3327 3327
=======================================
Hits 16276 16276
Misses 68 68
Partials 9 9 ☔ View full report in Codecov by Sentry. |
Thanks for these changes. It's worth noting that there are test build environments only (for unit tests). So there isn't a huge gain from your great finds. Shrink this docker container and we've got more of a rewarding outcome |
@@ -48,13 +48,15 @@ RUN ( \ | |||
dnf install -y rpm-build rpmlint python3-pip python3-virtualenv rubygem-ronn \ | |||
dnf-plugins-core 'dnf-command(config-manager)' \ | |||
'dnf-command(builddep)' sudo rsync rpmdevtools; \ | |||
dnf config-manager --set-enabled powertools; | |||
dnf config-manager --set-enabled powertools; \ | |||
dnf clean all; |
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.
This clean all
is not needed, it slows down the second dnf install
below
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.
It could be! Depends on the network environment and the upstream server being used.
The better way may be to merge those installs, so that the process will be fast, and the image will be slow?
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.
Just getting back to this, i think the containers referenced are gone. The fedora and el9 containers are only used to build an rpm and then exit. Your change can be applied to them if you want, but as the last entry after last install
Will close this issue off; was trying to point out that your |
This ensures that
dnf
doesn't leave unnecessary temporary files in the Docker images, thereby reducing their size.Regarding the change in image size, it seems there isn't much difference for the rawhide and f39 builds. However, the f38 and el8 builds have shown significant improvement.
For the image size changes, see the result below.
Before:
After: