klogg
klogg copied to clipboard
Optimize Dockerfiles for all Docker images
This commit optimizes the Dockerfiles for both Oracle and Ubuntu Docker images to enhance efficiency, reduce image size, and ensure adherence to best practices.
-
Consolidate
RUNcommands: This reduces Docker image layers and allows effective cleanup within the same layer. -
Standardize on apt-get over apt: apt is designed for interactive use, while apt-get provides a stable CLI interface for scripting. This change ensures script stability and consistency in Dockerfiles.
-
Adjust package installation: Use
--no-install-recommendswithapt-get installto avoid unnecessary packages and explicitly installca-certificatesin Ubuntu Docker images forwgetto function correctly with HTTPS. -
Remove temporary installation files: Further reduces Docker image size by cleaning up unused files post-installation.
These changes overall streamline the Dockerfiles, leading to more efficient and smaller Docker images.
Here's the result of the optimization, which is significant:
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu22.04 after ba8a163bd647 1 hours ago 1.22GB
ubuntu22.04 before 444d0d9ade14 1 hours ago 1.51GB
ubuntu20.04 after 9cfbaf385492 1 hours ago 1.15GB
ubuntu20.04 before 1f77992b16dc 1 hours ago 1.89GB
ubuntu18.04_qt5.15 after 6a3c4b985091 1 hours ago 1.13GB
ubuntu18.04_qt5.15 before 904e72f3c332 1 hours ago 1.24GB
ubuntu18.04 after f2be07fdd124 1 hours ago 953MB
ubuntu18.04 before 72288345a99f 1 hours ago 1.17GB
oracle8 after 91fa597e5366 1 hours ago 1.1GB
oracle8 before e4cb6d5953d2 1 hours ago 1.63GB
oracle7 after 4b03e24f6a86 1 hours ago 913MB
oracle7 before cf32ac6dfd47 1 hours ago 1.91GB
@variar the improvement result is huge, you may want to take a look ;)