-
Notifications
You must be signed in to change notification settings - Fork 103
Nickez/slim down docker image #1268
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
base: master
Are you sure you want to change the base?
Conversation
702d3d1
to
c967beb
Compare
c2c9e50
to
a6dff27
Compare
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.
utACK, but prefer to keep cargo install
for the two rust tools.
If your goal is to reduce layers, you could also move all of it to a docker_install.sh script and call that in a single RUN. @cstenglein has done that in this open PR #992, but somehow that PR was never merged.
I have a few goals I guess:
I do think you can take the released versions of bindgen and cbindgen where available. We aren't building any other tools from source. Perhaps we could build our own linux/arm64 versions and publish somewhere in case you don't want to have two approaches in the dockerfile. The reason a reproducible container is important is so that we can build older versions of the firmware at all. Today, since the image isn't reproducible we depend on docker hub having a copy of all the versions. You can imagine some future version of a debian or pip package after some "security update" isn't compatible anymore. I think calling out to a single |
That would be nice, but I would rank this as low priority for two reasons:
|
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.
utACK
Python should be invoked as `python3` since we are writing python3 code and not python2. See https://peps.python.org/pep-0394/#recommendation Many (most?) distributions do not distribute a "python" executable any more, forcing you to pick either 2 or 3.
a6dff27
to
f9154b1
Compare
All temporary files need to be deleted in every `RUN` command to avoid adding it in a layer. Removing them in a later `RUN` command will still make them bloat the final image. Instead of copying files temporarily they should be mounted in the `RUN` command where they are needed. This avoids the need to delete them at the end of the command. Environment variables that are intended only for when the container is built should be prepended on the lines where they are needed to avoid polluting the environment in the running container. We should strive to have as few layers as possible, but still enough to simplify debugging the container image. When you only have 1 layer it is not possible to create intermediate images and inspect the state of the image.
f9154b1
to
d51692f
Compare
Use
python3
interpreter instead ofpython
which is ambiguous.All temporary files need to be deleted in every
RUN
command to avoid adding it in a layer. Removing them in a laterRUN
command will still make them bloat the final image.Environment variables that are intended only for when the container is built should be prepended on the lines where they are needed to avoid polluting the environment in the running container.