A capillarity problem for compressible liquids