Just an update, I thought I should mention the cause which might help others who view this tread on a later time. The time bazel server was exiting had nothing to do with the scripts that I was running.
When I created the issue on my laptop which was running windows and docker for this purpose. Bazel server exiting was not caused by some bad command but memory constrains, my observations while doing it on linux was that, the memory usage spikes while compiling the mkl library with a delta above 1.5Gigs. The WSL2 being used by Docker to manage the memory outright refuses to provide because of my limited 8G ram causing the bazel to error out. On linux it basically crashed.
The solution was pretty easy I had to compile on my desktop which had more ram available. Docker Hub : Sid911/tflite-builder 2 This is the image I uploaded for my own devops use, just in case someone doesn’t want to build it they can use it. I will update it per month for my own project but that’s not guaranteed.