Grand thermodynamic potential in a static spacetime with boundary