There is already a post for that https://community.gladysassistant.com/t/build-automatique-de-limage-raspberry-pi-os/6124