Have you looked at preloading?
This can probably save you some time in deployment by already including the application in the initial image you write to the devices.
You will also want to look at the delta updates.
Can you maybe share your docker-compose (and Dockerfiles)?
It can maybe give some insights in how to reduce size.
I’m guessing one of the reasons your image is so big, is that you need an SDK to build the nvidia driver? Multistage builds may help reduce the size of what you’re actually deploying by splitting up the process.
Hi, couple of optimizations right of the bat to make the dockerfile cleaner, slimmer
Start using install_packages command that come packaged in every balena base image. Install_packages is a installer script that:
Install the named packages, skipping prompts etc.
Clean up the apt metadata afterwards to keep the image small.
Retrying if apt fails. Sometimes a package will fail to download due to a network issue, and this may fix that, which is particularly useful in an automated build pipeline.
Next, any specific reason to install Docker
Why not install all OS dependencies in one step for them to be more easily cached?
Why install Python when you can use the base image from balena that has Python pre installed, check out Docker Hub (You will find a similar base that is available for your device type)
Optionally to build faster, you can use a beefier local build machine (balena ARM servers are already quite substantial) so that you can use balena build command to build locally and then using balena deploy to deploy that image.
With each round of optimizations, do post the metrics for the final image so that we know we are making progress. Another hard optimization you could possibly do would be to use multi-stage builds but that very much depends on your usecase.