i would carefully check the weight tolerance of the roof first or if you have some sort of method of reinforcing, do so before planting.
I would think that you could build a 4x4x4 box of some sort to put your tree in, that
should probably do it for most fruit trees, but I would also plant small size growers or dwarfs..best if you can find natural dwarfs..some plums are naturally dwarf. If you want to avoid spread you can try the pole varieties, they grow tall and narrow..remember dwarfs are not as strong and healthy as a standard tree, however, it is better than NO tree ..and if it is a rooftop and that is all you have..get the dwarfs, there are even superdwarfs that are avail for confined areas.