-
Notifications
You must be signed in to change notification settings - Fork 97
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
dev: reduce docker layers & combine install commands #992
base: master
Are you sure you want to change the base?
Conversation
Thanks.
Can you quantify that? What's the difference in size and build time roughly? |
Hi @benma
Sure, but it's not perfect since a big part of the image build time are the downloads. Used master old Size 4.8GB current branch Size 4.79GB So size decrease is negligible, but build time decreased a bit (~10%). |
Have you considered moving most steps into a installation script, hence collapsing most of the layers into one? the BitBoxApp does that: https://github.com/digitalbitbox/bitbox-wallet-app/blob/master/Dockerfile#L21-L22 |
Hi @benma
Cool idea, will try that in the coming days, thanks! |
No worries, and thanks! Note that there were a lot of changes to the Dockerfile that were merged already. When you try, make sure to use the latest Dockerfile from |
9925e66
to
9ce3b08
Compare
e1372c3
to
1696a5a
Compare
@benma should work now please test :) squashed the commits as well. |
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.
Great work!
Could you add a small rational in the commit message body for why this is useful? As you mentioned before, a bit of reduced space and ~10% faster build time.
doxygen \ | ||
graphviz \ | ||
python3 \ | ||
python3-pip \ | ||
clang-format-15 \ | ||
clang-tidy-15 \ |
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.
These were in separate RUNs before grouped by topic (docs, CI). Would be nice to to add a comment before each group like you did below with the pip installs.
# Make Python3 the default | ||
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 | ||
|
||
# install pip |
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.
Upgrade pip - it was installed before
Hi @benma Thank you for the review! Currently I'm very limited in my time so I'm converting this to a draft and reviewing it at a later time. Hope that's fine. |
@cstenglein I had actually already approved your PR, the rest were just small improvements. If you want we can merge it as is and I add these small changes on top. Let me know. |
This reduces the layers of the DockerFile from 41 to 28.
First, I merged multiple
apt-get
&pip
installs to one. Currently there are twoapt-get
installs (one with basic tools likewget
& one with the rest).Second, I merged multiple
ENV
&RUN
statements into one but was conservative in that regard to not merge all statements, but just adjacent ones.This should reduce the install time for the image a little bit & reduce the image size.