uv's guide for use in containers is a better reference for this: https://docs.astral.sh/uv/guides/integration/docker/#compili...
I stumbled on this by porting something using that was previously pip, and that surprisingly different default has been a foot gun.