Reputation: 2779
I'm dockerizing a Flask / React application. I've started the process by installing gunicorn so that I could make this the default web server, and to that end created a wsgi.py
file to load the application from there, and then from the command line I ran:
gunicorn --bind 0.0.0.0:5000 wsgi:app
And it worked without any issues.
Now I'm attempting to dockerize the app for my first time. I didn't use a gunicorn.config file yet but I've seen it referred to in a couple of articles.
Do I need to add a gunicorn.config file to my application in order for it to run smoothly once inside a Docker container? I'm leaving it out for now but I'd appreciate any advice on what is good practice or downright necessary.
Upvotes: 0
Views: 507
Reputation: 97
It is generally a good idea to export any modifiable configuration to a config file when running your app in production. You don't have to use a config file, but hard coding all the configuration means you'll need to rebuild and redeploy the image if you want to make a change, which is not ideal.
When using Docker, you can use the -v
option to mount specific files/directories from the host to the container, which is what you'd want to use when mounting an external config file.
Upvotes: 1