Ruby gets updated by providing a new base image for the container.
Postgres upgrades are more complicated, but when it’s needed, the database gets backed up, converted to the new format, and then migrated over. It mostly always works. They typically skip every other Postgres upgrade, so it’ll be a while before it happens again. (If you really care, you can look at the postgres templates in the templates
directory of the discourse_docker
repo.