Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReduce image size #1283
Reduce image size #1283
Conversation
747e42c
to
b0b43b6
b0b43b6
to
116fcfa
|
I don't think removing LICENSE files arbitrarily is safe, as some license require the text to be distributed with the code. |
|
You're right, I will keep the license files. |
|
It's probably best to not strip the binary. Maybe on the slim image, but even then I'm not sure. Users who need an image smaller than alpine or slim can either delete the unnecessary files from this image on a new layer, or they can build one from scratch using our Dockerfiles as base. I'd be curious which use cases require such savings on a dependency image (which is only downloaded once per version), since those are usually more worth on final images (which are usually significantly bigger and built many times).
This means users who install native modules will need to download the headers every time they build their images, so the tradeoff is 3.9MB on the base image vs. increased build time for all users who need headers. |
|
Documentation seems fine to remove IMO? All others can cause some impact to our users. If we're moving forward with this we'll probably also need to remove it from the other alpine images and the slim images (the gains on the normal image would be very small). Also, would it need to be semver-major and thus wait for v15? If not we can do this for v10 and v12 as well. |
|
@mmarchini What about the yarn compile cache? |
|
I'm not familiar with yarn enough to know how impactful removing it would be to our users, so I'll defer to others to answer that |
|
As far as I can see the |
| && yarn --version \ | ||
| # remove unnecessary files | ||
| && rm -rf \ | ||
| /tmp/v8-compile-cache-* |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Aschen
Sep 17, 2020
•
Author
Usually I'm not comfortable to use a wildcard but since it's the tmp folder it should be ok.
|
@mmarchini About the cache the choice is between some performance gain for some packages or a 2.3 MB gain in image size. My thought are it's better to reduce the image size for everyone than improving the perf for certain packages |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.


Aschen commentedJun 26, 2020
•
edited
What this PR do?
This PR reduce the.alpineimage size by 20% from117MBto93.5MBThis PR reduce the
alpineimage size by 7,5% from117MBto108MB.strip node binary (10MB)remove c headers (3.9MB)~6MB)remove unnecessary files such asLICENSE2.3MB)If those changes are ok for you, I will do the same for other images.