Zeta function regularization for a scalar field in a compact domain