ThePorgs / Exegol-images

Docker images of the Exegol project
https://exegol.readthedocs.io/
GNU General Public License v3.0
73 stars 56 forks source link

Reduce image size - remove pip cache dir #341

Closed lap1nou closed 2 months ago

lap1nou commented 2 months ago

Description

Greetings,

This PR aims to reduce the image size by more than 100 MB by removing pip / pipx / pip3 cache directory.

I'm not an expert but I think the pip cache directory is useless in our case since we aren't going to need them after on, so we don't care about them being cached.

I saw this trick from here: https://stackoverflow.com/questions/45594707/what-is-pips-no-cache-dir-good-for

Related issues

N / A

Point of attention

I tested a few package and it seems to work fine.

The cache is located in the folder /root/.cache/pip/ and while they are not present in the final image (they are probably cleaned up at some point but they still take some space because they are present in the layers of the image).

I would also say that there is 3 ways of getting rid of this cache:

I've only done this for the ad script for now, I will continue for other steps if you like this PR.

Regards.

QU35T-code commented 2 months ago

Thx @lap1nou ! Better if arguments are just after : pipx install and not at the end of the line (code compliance check)