Variable name AUTOCONFIG need changed to CONFIG and AUTOCONFIG["dbpass"] to CONFIG["dbpassword"]
This deploy without above changes only work with:
custom.config.php: |-
<?php
$CONFIG = array (
'dbtype' => 'pgsql',
'dbname' => 'nextcloud',
'dbhost' => 'hostname',
'dbport' => '5432',
'dbuser' => 'nextcloud',
'dbpassword' => getenv('POSTGRES_PASSWORD'),
);