-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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: use multi-stage build to reduce size #6938
Conversation
|
Using the above code, I made an image submission, and the image size on DockerHub is 70 MB, :D https://hub.docker.com/r/soulteary/shields/tags?page=1&ordering=last_updated |
Thank you for this! Admittedly having a compact image size isn't a real goal of the project, but I am generally in favor of leveraging builder images. However, I've not had any luck getting the image to build locally, neither from the PR ref nor from our default branch. The changes themselves look fine, but I'm mildly apprehensive about moving forward unless one of the other maintainers is able to get it building given that we just recently lost our docker auto builds and have #6849 pending |
I tried checking this PR out and running a
..but then I checkout out master, ran a build and it throws the same error so that might be a red herring. I'm not sure I've ever built this image locally. Shall we see if we can get #6849 done first and then come back to this? |
Yup, that's the same thing I was getting. My weekly jobs that build from source are working fine though, including from master. I wonder if there's interference from the output of other scripts/general inner dev loop that don't pop up in the clone-and-build only scenarios |
Right yeah I just tried it with a clean checkout and I think it is because of a dirty local working tree, not changes in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, the current container size is too large, the local image size is close to 1GB.
docker images | grep shields shieldsio/shields server-2021-07-01 c567959e0651 7 weeks ago 848MB
And I've test the local build, the size is almost close to 1GB.
For images used in the production environment, it is recommended to use docker multi-stage build, which can significantly reduce the size of the image in actual local use and reduce the size when pushed to dockerhub.