Optimizing release build

Hi,

I’m trying to improve build time when deploying new images. My first step was to prebuild all images and then juste used tagged images in docker-compose.yaml. That way, I expect that if I update only one image, only this one should be transfered to the balena cloud servers and to the devices. I discussed this here and that I was expecting faster build time and was encouraged to do so, so here it goes

However it looks like even with the exact same images, balena push still have to upload the whole images to Balena Cloud. Is this normal ? I was expecting not to have to do this because it feels similar to pushing to a docker registry and docker can avoid pushing an image if its already present on the registry. I suppose the images I’m pushing are already stored on Balena Cloud since Balena Cloud is able to push those images to the devices. I don’t know how Balena Cloud work internaly but I think there’s room for improvement here

Then, Balana Cloud build the release. This too takes longer than I expected when I’m pushing the same images the result should already be found in cache / storage and not rebuild.

This is probably related to how Balena Cloud store the releases, I can only make guesses on that. I’m willing to experiment, test and answer any questions you have on that subject

thank you! I would really love to help improve performance both for a convenience point of view and to lower resource usage globaly

1 Like

Hey Mathieu, did you have a look at https://www.balena.io/docs/reference/balena-cli/#deploy-appname-image? If you images are pre-built you can use balena deploy instead, which should improve the situation. When you do balena push it pushes everything to the builder, and then we see if there is a cache we can use for your build (which might not always be the case), but you should see in the build logs whether the cache was used or not.

indeed @sradevski it’s much better with balena deploy, I did not notice that balena push forced to upload everything again. I’m down to 1 and a half minute that’s not perfect but it’s very good !

Great news, glad to hear that!