docker-nginx
docker-nginx copied to clipboard
Entrypoint:envsubst skip if already done
Envsubst happens every time you start the container. Wouldn't it be better if it passed after finding file already touched by it?
This overwrites any manual changes made to the envsubst output conf file.
Example use case:
- create generic template
- run envsubst
- add ssl
- don't lose ssl when container restarts
If you're doing any manual changes to your containers ("add ssl" seems to mean just that), you're doing it wrong. I suggest implementing "adding ssl" as another entrypoint script then. I don't think mixing up multiple ways to configure things is going to cope well.
IMHO the config-altering scripts should not be run on entry point but rather manually on initial setup;
- The premise of a template is that you build generic one and use in multiple environments with envsubst making the basic tailoring.
- The default.conf can be result of initial automated tailoring, but should be open to subsequent changes during the container lifetime; that's the purpose of having configuration file - to be able to configure and reconfigure the server for it's specific situation. If instead we have to make changes to the template as it overwrites the file at each restart, the template loses it's purpose.
As to adding more scripts at startup - I'd prefer to avoid it. Editing config files with shell scripts is best kept to necessary minimum.