- You need a
requirements.txt
file at the root of your project folder - even if empty. You can also set an alternate path using theREQUIREMENTS_FILE
environment variable. - Mount your project folder as
/code
volume of this image. - To specify where your WSGI application module lives, you should use the
WSGI_MODULE
environment variable. It defaults toapp:app
, which will work if you have a WSGI callable namedapp
inside aapp.py
file in your/code
folder. - Finally, by default, uWSGI listens on a UNIX socket named
wsgi.sock
that will be placed in a newly-createdrun/
directory in your project folder (mounted to/run
inside the image). You should point your production webserver to this socket in order to serve your application. You can also affect this behavior using theADDRESS
environment variable - set it to any other UNIX socket path (default/run/wsgi.sock
) or even to a TCP host/port (eg.127.0.0.1:5000
).
Basically:
docker run \
-v /path/to/your/code:/code \
-e WSGI_MODULE=yourmodule:yourapp \
-e REQUIREMENTS_FILE=/path/to/your/code/requirements.txt \
cheaterman/uwsgi
See also: Docker Hub repository