I had this exact issue - Discourse on DO with 2GB RAM and no swap worked fine, except for updating from the Discourse dashboard. So I would always rebuild the app via SSH instead.
Adding 1GB swap file fixed it for me; updating from the dashboard now works.