NGINX offers some very convenient Docker containers, but it is not documented how to extend the functionality of those containers without re-compiling NGINX yourself and continuously adapting your Dockerfile to match the ones in https://github.com/nginxinc/docker-nginx/.
This gist offers a way to build a NGINX βdynamic moduleβ against the widely used βnginx:alpineβ docker image. Simply copy this Dockerfile & replace the arguments of the βwgetβ & βtarβ & βconfigureβ commands to include the module you want to build, then adjust the COPY command copying the module (.so file). In this example the NCHAN module is used as an example.
If you found this helpful, please leave a comment / reaction here! :love:
Thank you so much. It took me 2 hours to find this approach after thinking of recreating the complete image from scratch... Many problematic solutions were attempted... But this went very easily.
I've updated the dockerfile a bit by making it easier to switch which module should be added and updated the dev dependencies. My version is customized to use the more headers module (nginx-mod-http-headers-more in the alpine package manager).
My version: