Spin-glass and ferromagnetic phases of the random-bond Ising model on the Bethe lattice