Public | Automated Build

Last pushed: a year ago
Short Description
nginx docker image with dynamic conf support via ejs
Full Description

pmkr/nginx

nginx docker image with dynamic conf support via ejs

example

docker run -it       \
--net=host           \
-v $PWD/your.conf:/nginx/nginx.conf \
-v $PWD/data.yaml:/nginx/nginx.yaml \
pmkr/nginx

volumes

/nginx

nginx configuration that will be prepared and moved to /etc/nginx

environment variables

WATCH

Glob pattern(s) of files to watch, separated by -- (space, dash, dash, space). When a watched file changes, conf files will be recompiled and nginx will reload.

-e WATCH="/nginx/*.conf"
-e WATCH="/nginx/*.conf -- /nginx/data.*"

signals

SIGHUP

If you signal SIGHUP to the container, conf files will be re-compiled and nginx will reload.

.conf templates

.conf files under /nginx will be compiled with ejs.

data file

The following files can be used to pass data to conf templates, having this priority:

  • /nginx/data.js export data as a module
  • /nginx/data.yaml
  • /nginx/data.json

The data will be available in conf templates as data.

These files will be reloaded on each conf compile.

// data.js
module.exports = {port: 1234}

# .conf template
<%= data.port %>

env

Environment variables are available in conf templates as env.

# docker environment
-e port=1234

# .conf template
<%= env.port %>
Docker Pull Command
Owner
pmkr
Source Repository