A Hartlepool teenager spouting racist abuse before rioting broke out in the town has been locked up for his shocking behaviour.