Well, we choose the standard plugins carefully so as to serve the widest number of users (predicted) without bloating the code base or introducing a maintenance burden. It’s a delicate balance.
It’s tricky to get statistics on how many users have Caddy with add-ons or without, but the new build server in the future will give us a better idea.
Anyway, the 6 or so Docker images that are already produced are split about 50/50. 3 of them do not include add-ons, 3 of them do. Of the 3 which do, 2 of them only include the git add-on, and 1 of them includes all of them (but goes out of date very easily).
If there is to be an “official” image, it probably should be without any third-party add-ons; just Caddy core and its standard plugins.
ONBUILD would allow us to create a base Caddy image that would include everything needed to build Caddy+plugins. Then a consumer would make a new Dockerfile to use it like this:
FROM caddy/caddy:base
ENV PLUGINS git,hugo
// Entrypoint & CMD
That way users get to easily choose their plugins without having to wait for compilation whenever they run the image.
Actually, NGINX recently added support for dynamic modules in 1.9.11 so now, at least for some third-party and native modules, you don’t have to recompile NGINX to add new features.
That’s cool! Probably is really nice for people who use Nginx, as it compiles pretty slowly.
I’ve realized an image that builds when run wouldn’t work well at all. I find myself recreating containers all the time with docker-compose, so fast startup time is a must.
# Dockerfile
FROM caddy/caddy:onbuild
# Nothing else in this file
And then the user would have to have a file called plugins in the same directory, that the onbuild directives would derive the requisite information from. This is more or less how the Rails onbuild image works.
git,hugo
I’ll try and whip up a proof of concept this weekend.
It would be ideal to do it your way, what I’m saying is I’m pretty sure it won’t work. All of the onbuild instructions would happen before ENV PLUGINS git,hugo was set properly.