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

Analysis: Docker image size reduction #139

Open
silkroadnomad opened this issue Mar 10, 2020 · 3 comments
Open

Analysis: Docker image size reduction #139

silkroadnomad opened this issue Mar 10, 2020 · 3 comments
Labels
B priority bounty make money enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@silkroadnomad
Copy link
Collaborator

The Doichain/dApp docker image seems far to big. An analyzes needs to be investigated what are the things which make it so big and how could we reduce it later on. Please provide your suggestions in the Github Issue.

@silkroadnomad silkroadnomad added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers bounty make money labels Mar 10, 2020
@jay-dee7
Copy link
Contributor

hey @inspiraluna, my initial analysis is:

  1. we're trying to do too many tasks inside a single image (we can split it to fasten the build time)
  2. node:12 as base is 340 MB, maybe we can go with an alpine or slim version which would only have a base image size around 30-40MB
  3. We have too many RUN clauses, which leads to multitude of docker layers inside the image and doesn't work well with caching. if we can somehow combine multiple RUN clauses into a single or maybe two, it'll help.
  4. we can also remove the compile time dependencies after the build is done (few are already being removed).

I'll post a dive analysis of the image later on, which will help us understand it much better

@jay-dee7
Copy link
Contributor

@inspiraluna i've analyzed the docker image. Here are the findings:

  1. RUN statement from line 9 of base.Dockerfile leads upto: 1.5 GB, these all are either dev tools (vim, jq, bc, git) or compile utils (build-essentials,apt-utils and other libs), we should remove these after compiling the meteor app.
  2. RUN statement on line 62 of base.Dockerfile leads upto a whopping 2.8GB, i'm sure we can do something around here to make it all light.
  3. Finally, RUN clause of main Dockerfile, line 78 sums upto 1.3 GB of size, here we have very little to improve i believe.

The final decompressed image is 6.7GB and size on docker hub is 1.7GB (compressed).

I think we we focus our efforts into these 3 checkpoints, we should be able to reduce the size of our image by a significant factor

@jay-dee7
Copy link
Contributor

Hey @inspiraluna, i believe the above mentioned analysis should be enough to get us started and cut the size of the image by at least 30-40%. Please let me know if you have any inputs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B priority bounty make money enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants