Both CPU and RAM are essential components when it comes to music production. Every DAW will always make use of both CPU and RAM so there's no need to really say one is more important than the other except that in some music production projects, tonnes of RAM will be required to efficiently run loads of audio sample libraries instances. (e.g Kontakt libraries)
It's always advised that as a music producer you should spend money on a desktop or laptop that has the fastest CPU you can afford. In addition you should make sure that the same desktop or laptop also comes equipped with RAM that will allow you to fit your needs when you decide to run Kontakt Libraries.