Rebuild fails with yarn errors

The second line tells the whole story

fatal: not a git repository (or any parent up to mount point /var)

Your /var/discourse directory is not a git repository, which breaks our auto-update of launcher and the tools we use to bootstrap Discourse, which in turn means you are stuck in an old docker image.

You need to undo the changes you did to break that.