How to add additional postgres configuration during docker setup

I’m setting up to run the musicbrainz-docker environment, but the main file filesystem is ZFS. There are some specific tweaks for running postgres with the DB on a ZFS dataset, both in the dataset config (recordsize, etc.) as well as in postgres itself.

Specifically, we would want to have the following done after DB creation

ALTER SYSTEM set full_page_writes=off;
ALTER SYSTEM set wal_init_zero=off;
ALTER SYSTEM set wal_recycle=off;
SELECT pg_reload_conf();
CHECKPOINT;

Is there any way to cleanly add that to the initial docker-compose build or more likely to the docker-compose run --rm musicbrainz createdb.sh -fetch ? Poking around in that createdb.sh I see the actual creation in

/musicbrainz-server/admin/InitDb.pl

which looks like a good place, but that’s part of the images that are built.

You can use a dockerfile to create a new image from the official docker image, overwriting your createdb.sh with one having the correct file.

Or you may have more chances asking in the development channel of the IRC/Matrix/Discord