A docker image of python API server with using Gunicorn and Nginx.
$> docker run --rm \
--env GUNICORN_OPTS='--bind=127.0.0.1:5000 --workers=4 --worker-class=gevent --log-level=debug --capture-output' \
--publish 0.0.0.0:8080:80 \
nginx-gunicorn-python-api
GUNICORN_OPTS='--bind=127.0.0.1:5000 --workers=4 --worker-class=gevent --log-level=debug --capture-output'
You can extent more Gunicorn varible in this line reference to official document
The default setting is only provided as reverse proxy to localhost:5000
with 4 worker in using gevent. If you need to custom your configuration, you may use --volume
to mount the configuration file into your image or overwrite the configuration while you are building your image.