-
Notifications
You must be signed in to change notification settings - Fork 38
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
build: Update xml2rfc docker image #849
Conversation
I would suggest building the dev image on top of the which is published at Basically add back all the Python versions I removed from the base image + additional dev tools |
5529ab0
to
fb2c9a7
Compare
287c61d
to
90aa6aa
Compare
4f33901
to
7caa642
Compare
7caa642
to
06b8933
Compare
* Remove redundent docker publish workflow. * Add instructions to build and publish dev docker image. * Rename build-base workflow.
06b8933
to
3d30ee2
Compare
COPY README.md . | ||
COPY LICENSE . | ||
COPY Makefile . | ||
COPY configtest.py . | ||
COPY xml2rfc ./xml2rfc |
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 steps, particularly the last one, involve files that will change frequently. If your goal is to improve layer caching, then moving those steps to the end will improve that greatly.
RUN rm roboto-mono.zip | ||
RUN apt-get remove --purge -y software-properties-common wget unzip | ||
RUN apt-get autoclean | ||
RUN apt-get clean | ||
RUN pip3 uninstall -y decorator dict2xml pypdf2 | ||
RUN rm setup.py Makefile configtest.py requirements.txt |
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.
Running these as discrete steps won't reduce the size of the docker image, it only increases it. I'd cut these.
I'm interpreting this docker image as including a test, which is not really something that a dockerfile is well suited toward. If you want to test, maybe you can run these steps in the workflow instead.
RUN apt-get remove --purge -y software-properties-common | ||
RUN apt-get autoclean | ||
RUN apt-get clean |
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.
To save space, cleanup should be run in the same step as the files that are being created.
Also, I wouldn't bother removing software-properties-common; it's just not that much space to save.
RUN wget -q https://noto-website-2.storage.googleapis.com/pkgs/Noto-unhinted.zip | ||
RUN unzip -q Noto-unhinted.zip -d ~/.fonts/opentype/ |
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.
Running these as a single RUN step will reduce the number and size of the layers that are created.
RUN unzip -q roboto-mono.zip -d ~/.fonts/opentype/ | ||
RUN ln -sf ~/.fonts/opentype/*.[to]tf /usr/share/fonts/truetype/ | ||
RUN fc-cache -f |
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.
Same here.
@martinthomson, There's a workflow now that builds I have updated |
Thanks @kesara, that should work out to be a lot faster. I made a few suggestions that might help with image size, for those of us who live on the wrong side of the planet. |
@martinthomson, Thanks for the suggestions and I'm looking to implement them. |
Think of each command in the dockerfile as making some changes on top of the previous state. Each change needs to be saved and adds to the size of the final image. If you create smaller changes or fewer changes, the final image can be a lot smaller. This means consolidating actions into a single step is good. It also means that if you do something that creates temporary files (like entries in a cache), cleaning up those files during the step will produce less information to save for that step. Of course, you want to create checkpoints at certain stages: because layers are cached, if you can find some steps that don't change often, creating a layer means that you can reuse that state in future builds. So don't just lump everything together either. Build the image in stages: the most stable stuff comes first, the least stable stuff comes last. |
Fixes #846