Don't use runserver in production. Here's a project that has docker deploy files to help point you in the right direction
https://github.com/jointakahe/takahe/tree/main/docker
#Django Prject Deploy with Docker
1 messages · Page 1 of 1 (latest)
The use of nginx inside the same container, plus the run.sh having a nameserver setting (quad9 privacy DNS) makes the given repo a poor option (imho) in comparison to what I have here: https://github.com/maxplanck-ie/parkour2/
In short, replace CMD (bottom line in your dockerfile) with:
CMD ["gunicorn", "wui.wsgi:application", "-w", "8", "-b", ":8001"]
Also, I don't think you need to set the 'AS builder'.. though I lack the experience of using that setup because I have plenty of storage and saving few megabytes wasn't a need.
I've always had a question regarding the difference between running a Django container along a nginx container that serves as reverse proxy (via proxy_pass in nginx config), and the second option of running nginx in the same container as Django and deploying them as you normally would for a baremetal django project (i.e. gunicorn communicating with nginx via system sockets). Which one is the recommended/best way for deployment and are there other options?