As noted in this comment and again here, setting values in the in-container .env file has caused and is likely to cause additional headaches.
Remove the part of the entrypoint script that sets up the .env file and provide documentation on how to migrate if needed.