Optimal boundary regularity for a singular Monge–Ampère equation