tiangolo / uvicorn-gunicorn-docker

Docker image with Uvicorn managed by Gunicorn for high-performance web applications in Python with performance auto-tuning.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feat] support passing options to gunicorn

thomasleveil opened this issue · comments

It would be nice to be able to pass options to gunicorn.

I myself need to start gunicorn with the --access-logformat ... option. And #14 could be solved by passing the --access-logfile /dev/null option.

Ideally it would behave like most official Docker images :

  • running the container without command would start gunicorn without additional options (exact same behavior as today)
  • running the container with a command would either :
    • run that command. i.e: docker run --rm -it tiangolo/uvicorn-gunicorn:python3.7 bash
    • add options to the gunicorn command. i.e.: docker run --rm -it tiangolo/uvicorn-gunicorn:python3.7 --proxy-headers <---- this is the new feature

This would require to alter the start.sh script. One could copy part of the official mongo entrypoint : https://github.com/docker-library/mongo/blob/2628a9b53013985d9aec377567f664b68b79e3d9/3.4/docker-entrypoint.sh

and modifying the Dockerfile so that it reads:

ENTRYPOINT ["/start.sh"]
CMD []

This is actually supported by Gunicorn with an env var, it works by default, I just documented it here: https://github.com/tiangolo/uvicorn-gunicorn-docker#gunicorn_cmd_args 🚀

About the specific access log, you can now configure it (or disable it) as well: https://github.com/tiangolo/uvicorn-gunicorn-docker#access_log

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.