Global regularity of the solutions to the capillarity problem