[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize Dockerfiles for all Docker images #680

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PeterDaveHello
Copy link

This commit optimizes the Dockerfiles for both Oracle and Ubuntu Docker images to enhance efficiency, reduce image size, and ensure adherence to best practices.

  1. Consolidate RUN commands: This reduces Docker image layers and allows effective cleanup within the same layer.

  2. 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.

  3. Adjust package installation: Use --no-install-recommends with apt-get install to avoid unnecessary packages and explicitly install ca-certificates in Ubuntu Docker images for wget to function correctly with HTTPS.

  4. 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

This commit optimizes the Dockerfiles for both Oracle and Ubuntu Docker
images to enhance efficiency, reduce image size, and ensure adherence to
best practices.

1. Consolidate `RUN` commands: This reduces Docker image layers and
allows effective cleanup within the same layer.

2. 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.

3. Adjust package installation: Use `--no-install-recommends` with
`apt-get install` to avoid unnecessary packages and explicitly install
`ca-certificates` in Ubuntu Docker images for `wget` to function
correctly with HTTPS.

4. 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
```
@PeterDaveHello
Copy link
Author

@variar the improvement result is huge, you may want to take a look ;)

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.

1 participant