We study the ground state which minimizes a Gross-Pitaevskii energy with general non-radial trapping potential, under the unit mass constraint, in the ThomasFermi limit where a small parameter ε tends to 0. This ground state plays an important role in the mathematical treatment of recent experiments on the phenomenon of Bose-Einstein condensation, and in the study of various types of solutions of nonhomogeneous defocusing nonlinear Schrödinger equations. Many of these applications require delicate estimates for the behavior of the ground state near the boundary of the condensate, as ε → 0, in the vicinity of which the ground state has irregular behavior in the form of a steep corner layer. In particular, the role of this layer is important in order to detect the presence of vortices in the small density region of the condensate, to understand the superfluid flow around an obstacle, and it also has a leading order contribution in the energy. In contrast to previous approaches, we utilize a perturbation argument to go beyond the clas-