danielwelch / hassio-zigbee2mqtt

Hass.io add-on for zigbee2mqtt
Apache License 2.0
565 stars 190 forks source link

image size optimization #529

Closed G1K closed 3 years ago

G1K commented 3 years ago

The size of the images will be reduced by about 2/3 of the size of ~ 400 MB.

Other possible improvements:

Koenkk commented 3 years ago

@ciotlosm could you review this?

Anonym-tsk commented 3 years ago

Tested. Good job 👍

Koenkk commented 3 years ago

@ciotlosm the build stopped working after this PR. Already tried reverting it but that didn't help. Do you know what is going on?

image

ciotlosm commented 3 years ago

Hey. I have been away for a while. I will review all items later today and get back to you

ciotlosm commented 3 years ago

@Koenkk the upload problem seems to be related to credentials. Maybe something wrong with @danielwelch docker hub credentials. The image was built just the upload fails.

ciotlosm commented 3 years ago

@G1K I think would be great if we could adopt some of your optimisations in https://github.com/zigbee2mqtt/hassio-zigbee2mqtt that will become the official add-on. I will try to create a PR, but please help review as well. That also removes the use for pm2 as it uses different method to keep the service running.

G1K commented 3 years ago

It's a pity that there are problems with the publication of images.

yes I will adapt, but a little later. As an optimization option, I still use (run without npm), it saves time on not very powerful xiaomi gw, in openwrt, running npm even to show the version spends a lot of time.

Removing unused files (for example, via modclean) the size of all files together with node_modules is about 20 mb, the archive is 3-6 mb image https://openlumi.github.io/openwrt-packages/packages/19.07/arm_cortex-a9_neon/

or combining all the code (for example, via https://github.com/vercel/ncc) into one file allows you to fit the project in 8 megabytes together with the frontend image

But for devices with docker and HomeAssistnt. I think it will be redundant

ciotlosm commented 3 years ago

@G1K I've included your changes here: https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/commit/0b07170d27ca25f107386dd4ccc249c7a7ee3090

That's the reason we're trying to move to the "org" version of the add-on to allow more admins, in case someone is unavailable for a while.