Speaker cabinet does effect the sound. If it didn't, we'd have speaker elements in thin frames instead of the bulky boxes. If you're using the speaker elements from the old piano, a good starting point would be copying the dimensions of the space around the element. But, if you're already making the effort to build a new cabinet, it could make sense to find a plan for DIY active monitors and build them into the design. Speaker design is an art in itself, and could be a bit too much to learn just for a single project. Piano sound has huge transients, so a more powerful amplifier than what's built in most digital pianos makes sense.
If you're more adventurous, building a piano-like sound board could work. I have only an anecdote to back this: I was involved in a play where we had a piano on stage. The prop was a real piano with the harp and most of keyboard mechanism removed so that it could be carried by two people, and we had small active speakers inside it so that the keyboardist in the pit could play through them in the scenes where it was played. It sounded much more like real piano than the same keyboard through PA or the speakers outside piano cabinet. Of course, a big part of the illusion was that sound came from the piano prop and the actor was playing it, but I believe that the sound board added something that was missing from the keyboard's output.