If you have a dog outside it should always come inside when it gets below freezing out because the dog can freeze to death even when it has a doghouse.
A dog can safely sleep outside when the temperatures are above freezing but ideally I would never let a dog sleep outside unless the temp was gonna be 50F or higher for the overnight low.
Even when it's not freezing they still get cold and could get sick and they deserve to be inside where it's warm because I certainly would not want to sleep outside in any cold weather.
But always bring your dog inside if it's gonna get below freezing at night because the dog could freeze to death .