Open haraldreingruber-dedalus opened 2 years ago
I don't think that entrypoint script will correctly propagate signals to the Caddy process.
In general I would recommend either mounting the Caddyfile in, or creating a new image with the Caddyfile baked-in.
I don't think that entrypoint script will correctly propagate signals to the Caddy process.
Thanks for the great remark.
I've looked up how entrypoint scripts can forward signals to the main process. Apparently, when using exec
instead of eval
caddy is not started as a child process and handles signals correctly. I've updated the PR accordingly.
Sometimes it can be convenient to pass the config via an environment variable in order to avoid mounting a config file into the docker container.
For example, I wasn't able to figure out an elegant way to pass a Caddyfile from an Azure Container Group YAML. This way I was able to avoid creating an Azure File Share that can be mounted.
Implementation
An
entrypoint.sh
script was added, which checks if the variableCADDYFILE
is set. If it is, the content is written to./Caddyfile
. Afterward, the command passed to the container is executed.Usage example
This PR can be tested like this with
docker compose
Maybe there are more elegant ideas to achieve this. Looking forward to your input.