Migrate to `setpriv` from `gosu`
In theory this cleans up any warnings about older gosu binaries, uses native packaging, and remains backward compatible with the existing run scripts.
Fixes: https://github.com/docker-library/postgres/issues/1304
@jcpunk Are you still interested in pursuing this? Getting rid of the very heavy gosu dependency would be nice. Otherwise I'm happy to send my own PR. Thanks!
Took a quick stab at fixing up the merge conflicts.
In order to replace gosu with setpriv we'd need maintain a shell script that implements the gosu interface but runs setpriv so that users aren't suddenly broken in updated images if they are using gosu outside of the entrypoint. In other words, we consider gosu part of the interface of the container (just like we have a compatible symlink for su-exec on most of the alpine-based images for users that were using it there). While we'd ideally only have to maintain the script for the life of all current PostgreSQL versions (so about 5 years), I think realistically it'd probably be indefinitely and that's not something I want to add to our maintenance of the images at this time.
Perhaps just set up to use setpriv on postgres 19+?
Hmm, the API contract is the behaviour of the entry point, not its implementation? But anyway, a shell wrapper still seems massively easier than relying on an entire Go build chain just for a thing that a base Linux install provides by default. And it has only to be kept until current postgresql 18 goes EOL?