-
Notifications
You must be signed in to change notification settings - Fork 88
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
RFC: Improvements for better performance, caching & dev experience #64
Comments
A thing to consider is to differentiate between docker images needed for zephyr development, and docker images needed for application development. For zephyr development, it can make sense to have all toolchains bundled together in a single image as I may want to test my changes on MCU's from different vendors. But for application development, I usually only target a single MCU or MCU family, it's overkill and increases CI build times because a large image has to be downloaded. |
We've done a lot of this sort of work for ZMK in https://github.com/zmkfirmware/zmk-docker if you want to see some strategies we've taken. We have separate build (for CI usage), and dev images with full tooling. Also, we use a dedicated tag per target architecture, instead of a single tag with the full SDK. |
Can you report and numbers on docker image sizes for the different variants you have? |
You can see all the images (I mispoke, we actually use a different repository per target architecture, and tags for versions only) at https://hub.docker.com/u/zmkfirmware For example, the You can peak at the other build/dev images targetting other architectures, but they all end up roughly the same. |
I assume Ubuntu is used as the base out of convenience? |
Yeah, there were a few deps made easier by basing on Ubuntu, which didn't grow our image size that drastically compared to debian. I believe it was |
we already have 2 stages, CI and Developer. I can see how we can improve this with a Base image that can for example be used for building docs (right now we install doc packages in the doc actions directly)....
makes sense? |
That makes sense to me! That would still allow someone to developer their own images using |
I'd like to propose several improvements to the Dockerfile in order to make targeted images that are smaller & faster, leading to a better developer experience for maintainers and developers alike. I'm far from a Docker expert but have made my share of builder-type images, so hopefully we can get some extra input.
The biggest improvement would be breaking up into multistage builds. I'd suggest the following stages:
I'm roughly mapping to the different requirements.txt and use cases. Not sure if "compliance" should be created as well. I'm not fluent enough in all the dependencies but we can be more efficient with what's downloaded, installed & cached. For example,
Base
would only install the minimal packages (ex. install python but not renode,)pip install requirements-base.txt
, and so on.Other ideas to further improvements:
COPY
pip directory fromBase
to save download time (pip install
seems to take awhile)Alpine
Scratch
containerDevelopment
only include what we need (Scratch is useful for that too)ARGS
to further reduce downloadsThe text was updated successfully, but these errors were encountered: