Thanks for reporting the issue @sigmike. The ruby version issue will be fixed by a rebuild, so our main objective here should be to get the rebuild to run to completion.
I was able to reproduce the Build Error on a fresh stable-branch installation. It looks like yarn (the JS package manager we use) isn’t cleanly downgrading the workspace from the pre-installed 'tests-passed' packages to the versions required by the stable branch.
In the medium term we aim to switch away from using yarn as a package manager. So for now, I’ve added a workaround to the build process which will reset the node_modules directory when doing a rebuild for non-tests-passed installs. If you try rebuilding again, things should work much better.
https://github.com/discourse/discourse_docker/commit/4fe3ef733850349f48db11dc4dd587c4d5b70a64
Let us know how it goes!