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

Docker image size reduce #7675

Merged

Conversation

FrancoisCapon
Copy link
Contributor

Hello,

This Dockerfile use multi-stage builds to reduce the size of the final image and get a "dive image efficient score" at 100% (94% before).

Image name: squidfunk/mkdocs-material:latest
Total Image size: 184 MB
Potential wasted space: 22 MB
Image efficiency score: 94 %

Image name: squidfunk/mkdocs-material:multistage
Total Image size: 159 MB
Potential wasted space: 0 B
Image efficiency score: 100 %

dive

  • A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image.

Estimate "image efficiency"
The lower left pane shows basic layer info and an experimental metric that will guess how much wasted space your image contains. This might be from duplicating files across layers, moving files across layers, or not fully removing files. Both a percentage "score" and total wasted file space is provided.

@squidfunk
Copy link
Owner

Thanks for the PR. Not sure why, but the build does not complete.

@FrancoisCapon
Copy link
Contributor Author

If i'm not mistaken, buildx use docker 19.03+ and multi-stage builds was introduce in 17.06CE so no docker version issue.

In fact, this is a Client.Timeout at docker > Set up Docker Buildx not at Build Docker image.

I think I can't rerun jobs unless to add a empty commit, perhaps can you rerun it directly?

Booting builder
  /usr/bin/docker buildx inspect --bootstrap --builder builder-d6efd981-826f-4fe7-b3d5-54c5407cf9fe
  #1 [internal] booting buildkit
  #1 pulling image moby/buildkit:buildx-stable-1
  #1 pulling image moby/buildkit:buildx-stable-1 15.2s done
  #1 ERROR: Error response from daemon: Head "https://registry-1.docker.io/v2/moby/buildkit/manifests/buildx-stable-1":     Get "https://auth.docker.io/token?account=githubactions&scope=repository%3Amoby%2Fbuildkit%3Apull&service=registry.docker.io": 
     net/http: request canceled (Client.Timeout exceeded while awaiting headers)

@squidfunk
Copy link
Owner

Thanks for looking into it. I've triggered a re-run.

@FrancoisCapon
Copy link
Contributor Author

All checks have passed 👍

@squidfunk
Copy link
Owner

Great. I think this change should be safe. Always wanted to switch to the build step approach, but never had the time to investigate. Thanks for the PR!

@squidfunk squidfunk merged commit 9ec2ee0 into squidfunk:master Nov 8, 2024
4 checks 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