Skip to content

Conversation

@nwang92
Copy link
Contributor

@nwang92 nwang92 commented Oct 20, 2019

This PR should bring down the base image sizes significantly. I think redhat can be optimized further - the microdnf package manager seems to install a bunch of recommended packages under the hood and the remove command of it does not seem to uninstall those extra dependencies.

Before:

base-redhat-8             latest    ed848b93dbc0     4 days ago          415MB
base-debian-10            latest    5470efa26e67     4 hours ago         425MB

After:

base-redhat-8             latest    710edd6afbf9     About an hour ago   334MB
base-debian-10            latest    6a9e0c5d896d     3 hours ago         244MB

chmod +x /bin/busybox
microdnf -y --nodocs install gcc redhat-rpm-config python2-devel libffi-devel openssl-devel tar
microdnf -y --nodocs install python2-pip python2-devel redhat-rpm-config gcc libffi-devel openssl-devel
pip2 --no-cache-dir install requests ansible
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to use pip for these? Are there no rpm packages available? Perhaps we should try pushing this upstream to Red Hat?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the requests package at microdnf install python2-requests but none for ansible as of yet. Switching to python2-requests does not make much of a difference compared to the pip installed one:

base-redhat-8               latest         38feade3e92c       About a minute ago   334MB
base-redhat-8-piprequests   latest         ac651e75a3a5       3 minutes ago        334MB

I guess the only benefit would be to remove pip entirely for any image size savings, but we may still need it for ansible. I guess if we really wanted, we would also remove pip after we've installed the relevant packages?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree not worth it for just requests.. I think best approach (longer term) would be to push this request to Red Hat, and see if they could include rpm for ansible or alternatively include the s390 binaries for cryptography, so that the pip command doesn't require gcc etc. and building it from source.

@nwang92 nwang92 merged commit 5afd726 into develop Oct 21, 2019
@nwang92 nwang92 deleted the bugfix/reduce-base-image-size branch October 21, 2019 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants