I've been having a lot of trouble with Digital Ocean building Python containers.
Basically you either have to reduce the memory needed which is hard/impossible or build it yourself and push as it explains here: https://docs.digitalocean.com/support/why-is-my-app-platform-build-or-deployment-failing-with-an-out-of-memory-error/.