Docker doesn't handle sparse files the way you might expect. The physical space they take up on the host inside the image layers is equal to their virtual size. Due to this, this build process fills up the build cache very quickly and can be computationally heavy at the export stage.
My only idea to get around this is to build the rootfs and filesystems (FAT, EXT4) inside Docker, and then have some kind of tool on the build host create a sparse file, partition it, and weld the partitions together. This is something that needs to work on most operating systems - macOS and Linux at the least - because it was an original goal of this project.
Docker doesn't handle sparse files the way you might expect. The physical space they take up on the host inside the image layers is equal to their virtual size. Due to this, this build process fills up the build cache very quickly and can be computationally heavy at the export stage.
My only idea to get around this is to build the rootfs and filesystems (FAT, EXT4) inside Docker, and then have some kind of tool on the build host create a sparse file, partition it, and weld the partitions together. This is something that needs to work on most operating systems - macOS and Linux at the least - because it was an original goal of this project.