Hi, we’re currently optimizing our Mongoose OS build system to allow the developers to have faster development cycles.
The current machines were used for web development and are equipped with a 4 Core Intel i5 4th Gen CPU running Docker on WLS2 on Windows. They are able to build a complete FW in about 8/10 minutes.
As you can guess this slowed our development and to optimize it we installed on our server (12 Core AMD Ryzen CPU - 64GB RAM) the mgos build server running on Debian. The builds were faster: about 1 and half minute for a complete FW.
Diving deep dive in the building process, we tried to see if it was possible to optimize it even more and we noticed that at every build (even for the same project) the server re-downloads all the libraries and re-compiles the whole firmware. This is not something that happens on local builds, where only the missing libraries of the updated files are re-compiled. (although a whole re-build is triggered if a file is added/removed or mos.yml is updated).
Based on rough calculations, the build time could be optimized to less than 20 seconds if it was able to skip the already downloaded libraries and compiled files.
We managed to skip the re-download by increasing the upload file limit to 50MB (by editing the docker compose and adding
--payload-size-limit=52428800) and specifying the deps lib when calling the mos executable:
./mos.exe build --platform ESP32 --deps-dir deps/ --libs-dir deps/ --server http://X.X.X.X:8000 --verbose
Unfortunately this fails at the end (probably because of exec permissions):
... Adding api_bitbang.js: 834 Adding api_dataview.js: 7655 Adding api_bt_gatt.js: 922 FS stats : space total=233681, used=105420, free=128261 GEN /var/tmp/fwbuild-volumes/2.20.0/apps/iot-demo-fw/esp32/build_contexts/build_ctx_247885459/build/objs/fw_temp/manifest.json make: execvp: /mongoose-os/tools/mgos_fw_meta.py: Permission denied /mongoose-os/tools/mk/mgos_fw_meta.mk:24: recipe for target '/var/tmp/fwbuild-volumes/2.20.0/apps/iot-demo-fw/esp32/build_contexts/build_ctx_247885459/build/objs/fw_temp/manifest.json' failed make: *** [/var/tmp/fwbuild-volumes/2.20.0/apps/iot-demo-fw/esp32/build_contexts/build_ctx_247885459/build/objs/fw_temp/manifest.json] Error 127 make: Leaving directory '/app' ...
I’m not really familiar with Docker, is there a way to not destroy the container that gets created and re-use it for future builds of the same project unless a clean rebuild is triggered?