Nginx dockerfile


I checked nginx code repository as well as Internet to see if I can
get a Dockerfile to build nginx. I got a few references (like
GitHub - dockerfile/nginx: Nginx Dockerfile for trusted automated Docker builds.) but those are essentially to
run nginx, not build it.

I am looking to build different versions of nginx (say
top-of-the-tree, latest-stable etc.) easily. It would be very
convenient if a Dockerfile is presented with the source code which
will build one of the versions mentioned above. If required, a slight
modification can then build any version of nginx.

I would highly appreciate if somebody could point me to a source where
I can get a Dockerfile which builds nginx.


Hello Atul,

Is this what you are looking for? Keep in mind I just threw this
together to give you an idea of how you could do this and it should be
tested. Let me know if you have any suggestions or questions.

[email protected]:kmjones1979/docker-nginx-compiled.git


Hi Kevin,

Many thanks for the pointer. That is exactly what I am looking for.

Now counting on my own experience, I think such dockerfiles should be
integrated with the nginx source code itself. This will make the nginx
source code self-contained and build process consistent. Otherwise,
developers like me will go in every direction looking out for a
dockerfile and there could be different versions of it available from
multiple sources. Having an official version along with source code
will save a lot of pain and will bring good things along. It’s just
like having Makefile along with the code. As long as the base image
for container is available, I don’t see any reason not to include a
dockerfile with source code. – Just a thought.

Thanks again for pointing me to the right source!

Best regards,