Skip to content

RFC: Improvements for better performance, caching & dev experience  #64

@beriberikix

Description

@beriberikix

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:

  • Base
  • CI
  • Development
  • Test
  • Docs

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 from Base to save download time (pip install seems to take awhile)
  • Do "proper" caching with Docker's BuildKit
  • Be smarter when it comes to caching layers (we'll see some benefits just from moving to multistage)
  • Move to a smaller base image like Alpine
  • Create our own "base image" using a Scratch container
  • Having the "child" stages like Development only include what we need (Scratch is useful for that too)
  • Releasing child stages as images on Dockerhub. These could be autogenerated based on Zephyr release or Release+SDK combo
  • Integrate add project groups to upsteam west manifest zephyr#36324 as ARGS to further reduce downloads

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions