Not completely sure what you’re trying to accomplish but here’s another Compose file for reference. Like the one above it uses Posgre and Compose 2.x. Maybe it will help you debug.
https://git.habd.as/comfusion/high-tea/src/branch/master/docker-compose.yml
Also try bumping gitea to 1.6 and back to see if that has any effect on your own setup. For more info on how to do that see Upgrade Gitea Docker Compose.