A 40g should have a good T5 22'' Tube. It can sit right on top and be ab out 10-12'' above the basking area through a mesh top or about 12'' with no mesh top.
A 20g tank is a bit small for a T5 so I'd go with a T8 18'' tube with reflector or a 26w UVB200 coil in a dome fixture sitting about 6-8'' above the basking spot. A small dragon can handle a 40g breeder though. If you can get your hands on another one I would do that and move him in. You can offer better UVB exposure and a better heat gradient in a larger tank.