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 Docker image size with optimized layering and cleanup #860

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

PeterDaveHello
Copy link
Contributor

Streamlined Dockerfile by implementing best practices for a more compact image build.

Changes:

  • Combined RUN commands into a single layer to reduce layer overhead and decrease image size.
  • Executed package removal and cache cleanup in the same RUN command block as installations to prevent buildup of unnecessary data in the image layers.
  • Achieved a reduction in image size from ~700MB to 604MB, ensuring more efficient storage use and faster deployment.

This approach ensures that intermediate build artifacts are not included in the final image, optimizing both build time and the resulting image size:

REPOSITORY          TAG               IMAGE ID       CREATED          SIZE
mihari              after             9df52386bb6f   30 minutes ago   604MB
mihari              before            11c7b0edbee5   37 minutes ago   700MB

Streamlined Dockerfile by implementing best practices for a more compact
image build.

Changes:
- Combined RUN commands into a single layer to reduce layer overhead and
decrease image size.
- Executed package removal and cache cleanup in the same RUN command
block as installations to prevent buildup of unnecessary data in the
image layers.
- Achieved a reduction in image size from ~700MB to 604MB, ensuring more
efficient storage use and faster deployment.

This approach ensures that intermediate build artifacts are not included
in the final image, optimizing both build time and the resulting image
size.
@ninoseki ninoseki merged commit 240dc43 into ninoseki:master Dec 12, 2023
1 check passed
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.

2 participants