At least 39 people have died and dozens been injured after a fire ripped through an immigration detention centre in a Mexican city on the US border.