While refactoring our containerized apps, we realized that most of them running inside containers with useless libraries/dependencies. We figure out how to reduce the size of the container image from ~700Mo to ~130Mo.
Best practices when building the container image:
1- Start by the alpine image
2- add the dependency as long as needed
3- do a clean up at the end if you have “RUN apt-get update” or similar.
4- leverage docker multi-stage builds (container that builds the app should not be the same as the one which runs the app.. ).