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

recommendations for reducing image size and increase performance #19

Open
thescientist13 opened this issue Oct 17, 2017 · 1 comment
Open

Comments

@thescientist13
Copy link
Member

thescientist13 commented Oct 17, 2017

Got some good feedback (below) about the Dockerfile, in particular around driving the image size down. The current image size of the 0.1.0 release is 283MB, which does seem like a lot. Would be good to get it down somewhere around 40 - 50 MB?

Take aways are:

  1. Consider using a smaller base image, **Alpine Linux or a NodeJS base image, based off Alpine?
  2. Condense RUN statements to reduce layers
  3. Clean apt-get cache at end of a RUN (all on same line)
  4. Remove any downloads made with a RUN command (all on some line)

I think the big question is did you need ubuntu? If you don't absolutely need ubuntu try to stick to using alpine for your base for custom Linux containers as it's 5mb vs 188mb starting point.

Next like someone else said check if theirs not already an official base you can build off of in this case FROM node would have got you 3/4th of what you wanted then you could have just plugged in chrome and your Ci code

Lastly just search google for smaller docker file sizes theirs a billion pages. It basically comes down to try to keep related tasks on 1 RUN line so they are layered together
Especially if your using aptget yum or apk, that way you can also cleanup the cache of the installers on the same line. The reason for that is once a layer is written it's that size. So you can't apt update on one layer then clean the apt cache on another line as the previous layer already has those files saved and the new layer just has a notation to clear the files but the files are still in the original layer size.

This holds true for downloading Tar extracting and then removing the tar file make sure the remove is done on same line as the download or the tar file will still be in the higher layer.

@thescientist13
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant