How to avoid dynamic bundle optimization?

If you go chasing down memory leaks, please do open an issue on github. We're working on fixing the browser side issues, but we haven't been able to confirm any server side yet, and there's currently no open issues about it.

Instead I want to have control on when the build is done.

That's not something we can offer, it has to happen with changes since the bundle needs to be current. Of course, if you don't make any changes, the build step does not re-run.

Docker will restart the container one the limit is reached, but this doesn't work if Kibana has to rebuild the asset bundles.

It should not ever run that build step again. The first time you change the basePath setting and run Kibana, it will do a rebuild, because it has to set up that change across the entire app. After that happens though, the app will just run when you start it again. The exception would be if you make other changes, then it'll have to rebuild again.

So, after you change that setting and run it once (in a larger container, temporarily), you're done. If you continue to work from that snapshot of your container, it shouldn't run the build step again, so you can use a smaller memory container from then on.