Nginx ONBUILD FTW

I needed a lightweight nginx setup that I just throw config files into, thus was born docker-nginx-onbuild. The base container will add any files in the context to /etc/nginx and your CMD need only be arguments to nginx.

To build our nginx container here at Djed, my docker context has a few files:

  • conf.d/site.conf
  • ssl/certificate.crt
  • ssl/certificate.key

My Dockerfile is very simple and looks like this:

FROM jcderr/nginx-onbuild:latest
MAINTAINER Jeremy Derr my@email
CMD [ "-g", "daemon off;" ]

site.conf defines my upstreams (which are sockets exported by other containers) and my hosts, and that’s about it.