cnpem / epics-in-docker

Container images with EPICS and modules
5 stars 2 forks source link

Prune unused artifacts from non-static builds #59

Open henriquesimoes opened 6 months ago

henriquesimoes commented 6 months ago

Both dynamic-link and no-build targets generate unnecessarily large IOC images due to the trivial COPY done from /opt. Clean up everything from there and /usr/local directory before doing the COPY to the IOC image.

Clean up strategy proposed here is the following:

For pruning module directories, another approach that could be followed is to delegate this responsibility to install_module. This way, we can have contextualized pruning for modules. On the other hand, this cannot be as aggressive as implemented in this proposal, as build-dependent files (the ones defining the build-system itself, for instance) must exist until the IOC build is complete.

I have tested this with ad-aravis-epics-ioc, and it shrinks the image size from 1.33GB down to 322MB.

This should be further tested and extensively reviewed, so that no artifact is removed unexpectedly.

henriquesimoes commented 6 months ago

I'm waiting for #57 to be merged to rebase it. As of now, this would mean another step is introduced which removes all IOCs installed in the base image.