ffenix113 / zigbee_home

Project to provide functionality similar to ESPHome but for Zigbee instead of WiFi for nRF52
https://ffenix113.github.io/zigbee_home/
GNU General Public License v3.0
528 stars 10 forks source link

Builder image #73

Open felipejfc opened 3 months ago

felipejfc commented 3 months ago

Add a dockerfile for working build environment on container, add docs.

Setting up a working environment to make ncs, zephyr, ndk and zigbee home all work well together can be challenging. Especially since there are so many different environments, linux, windows, osx, osx arm64, linux arm64 etc So I think it will be nice to have a working container that saves the user the hassle of needing to set up everything manually.

ffenix113 commented 3 months ago

Hello @felipejfc ,

Thank you for the PR! But I think at this stage of the project it would be a bit easier to use solution suggested by @evanraalte here:

Regarding the build option for users. Perhaps a --build local and --build docker would suffice? In that case a seperate --flash option is required as well I think.

There is already a Docker image available to start with from Nordic, and it would be easier to add a build command, similar to existing one, which would use already available image. Granted, image from Nordic should be treated as a base to build custom images, but it should be enough for our purposes.

felipejfc commented 3 months ago

Hey @ffenix113, even though there's an Image from Nordic (I used it as a base), it doesn't contain zb home binary, so to build with docker we either generate a new image where we include it or we copy a binary to inside the container in runtime which is not a great practice. Is this what you're suggesting or are you thinking on a third option? With this image I've pushed we could implement the build --docker

ffenix113 commented 3 months ago

Is this what you're suggesting or are you thinking on a third option? With this image I've pushed we could implement the build --docker

What I meant was that there is currently a function that will run a command to actually build the firmware. By prepending a necessary Docker command (i.e. docker run --rm -v ... nordicplayground/nrfconnect-sdk:v2.6-branch west build ...) we can forward the build process to the docker image, without doing anything more complicated. The one issue I have currently with this approach is permissions, as Nordic's image uses root user inside, and this would not be ideal for resulting firmware, as user then would need root permissions to do any changes to resulting files.

I do have a somewhat working solution to change user by creating a new Docker image from Nordic's base image, but have not yet tried to merge it to the base image.

What could be a step forward after this is to have a leaner image without samples, docs, unnecessary modules/drivers that can be used more freely.