The people at the Armbian team have been doing an impressive work at optimizing and generating Debian images for many ARM boards.

While they have documentation on the build process, it focuses mostly on setting up a build environment on VirtualBox with Vagrant.

They do support building in a Docker environment, but I found the documentation lacking and I saw myself asking in the forums.

It is easier to set up Docker than virtualization, plus the containers spawn so much faster so we can better iterate and make modifications in the build.

I will just reflect here the commands to produce a fully automated build for an Odroid XU4, headless Debian Stretch image

git clone https://github.com/armbian/build armbian-build cd armbian-build ./compile.sh docker BOARD=odroidxu4 BRANCH=next KERNEL_ONLY=no KERNEL_CONFIGURE=no RELEASE=stretch BUILD_DESKTOP=no

All the build options are here. I personally add these ones