-
Notifications
You must be signed in to change notification settings - Fork 191
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
Optimized Dockerfile to reduce uncompressed image size #276
Conversation
Combining apk del commands in the same layer as their add commands shaves off ~270MB when uncompressed.
Thanks! |
I'm quite curious what caused the compressed image size to go from 200-300MB to jump to 750MB from version v0.10.0 to v0.11.0 though. When uncompressed right now, the image is taking up 1/10 of the space of my 20GB VPS. Which ultimately inspired me to do this PR, but I wonder if we can find a way to reduce the image size even more after this is merged. EDIT 1:
If it's not needed in amd64, maybe we could do an architecture check during build time (using EDIT 2:
This yields even better sizes for
@milesmcc @CasperVerswijvelt do let me know if you guys are okay with this approach, I can append this change to this PR as well. |
@jarylc while I'm not really familiar with all the dependencies of Shynet, if the I'm also curious why such huge dependencies are needed at all, just for the cryptography package (and why they are only needed when building for aarch64). Could you maybe shed some more light on that, @milesmcc? |
I don't entirely remember; I think the issue was that for the aarch64 build, a lot of binaries do not come pre-compiled, so we need to install the rust/libffi-dev toolchains to compile those dependencies ourselves. Perhaps the story has gotten better since then. If aarch64 builds (and runs) correctly without rust or libffi-dev, then that suggests that precompiled binaries are now available for aarch64, in which we can drop those deps. |
I'll try to find some time to test removing the dependencies with my RPI4 sometime soon. |
I'm currently testing 1628820 live on my websites now (on amd64), will update EoD if any issues EDIT: Alright, looks like all is good on amd64 without these 2 dependencies, shaving half of the image size! Hope we can get this change in first. |
Combining apk del commands in the same layer as their add commands shaves off ~270MB when uncompressed.