Proof (maximum modulus principle)
Since $U\cup \partial U$ is closed and bounded, it is compact, so $|f|$ attains a maximum on $U\cup \partial U$.
If the maximum occurs at $z_0\in U$, this means there exists some disk $B(z_0,ε)\subseteq U$ such that $|f(z_0)| \geq |f(z)|$ for all $z\in B(z_0, ε)$. By the local maximum modulus principle, $f$ is constant on $B(z_0, ε)$. Then the identity theorem implies $f$ is constant on $U$, and by continuity on $U\cup \partial U$, in fact $f$ is constant on $U\cup \partial U$.