Focus stacking uses software to integrate and merge several images shot at slightly different focal distances into one single photo with a greater depth of field.
Use the setup above, but once you have your exposure determined set everything to manual so the exposure cannot change.
Then take several photos in sequence. Start with the focus point slightly in front of your object and on each subsequent picture move the focal point slightly further back.
Specialist software such as CombineZ, Helicon Focus can be used. General imaging software like Adobe Photoshop have stacking features built in.