Dockerfile 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. FROM python:3.7-buster
  2. LABEL maintainer="Sebastian Ramirez <[email protected]>"
  3. ENV VERSION python3.7
  4. COPY install-nginx-debian.sh /
  5. RUN bash /install-nginx-debian.sh
  6. EXPOSE 80
  7. # Expose 443, in case of LTS / HTTPS
  8. EXPOSE 443
  9. # Install uWSGI
  10. RUN pip install uwsgi
  11. # Remove default configuration from Nginx
  12. RUN rm /etc/nginx/conf.d/default.conf
  13. # Copy the base uWSGI ini file to enable default dynamic uwsgi process number
  14. COPY uwsgi.ini /etc/uwsgi/
  15. # Install Supervisord
  16. RUN apt-get update && apt-get install -y supervisor \
  17. && rm -rf /var/lib/apt/lists/*
  18. # Custom Supervisord config
  19. COPY supervisord-debian.conf /etc/supervisor/conf.d/supervisord.conf
  20. # Which uWSGI .ini file should be used, to make it customizable
  21. ENV UWSGI_INI /app/uwsgi.ini
  22. # By default, run 2 processes
  23. ENV UWSGI_CHEAPER 2
  24. # By default, when on demand, run up to 16 processes
  25. ENV UWSGI_PROCESSES 16
  26. # By default, allow unlimited file sizes, modify it to limit the file sizes
  27. # To have a maximum of 1 MB (Nginx's default) change the line to:
  28. # ENV NGINX_MAX_UPLOAD 1m
  29. ENV NGINX_MAX_UPLOAD 0
  30. # By default, Nginx will run a single worker process, setting it to auto
  31. # will create a worker for each CPU core
  32. ENV NGINX_WORKER_PROCESSES 1
  33. # By default, Nginx listens on port 80.
  34. # To modify this, change LISTEN_PORT environment variable.
  35. # (in a Dockerfile or with an option for `docker run`)
  36. ENV LISTEN_PORT 80
  37. # Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app
  38. COPY start.sh /start.sh
  39. RUN chmod +x /start.sh
  40. # Copy the entrypoint that will generate Nginx additional configs
  41. COPY entrypoint.sh /entrypoint.sh
  42. RUN chmod +x /entrypoint.sh
  43. ENTRYPOINT ["/entrypoint.sh"]
  44. # Add demo app
  45. COPY ./app /app
  46. WORKDIR /app
  47. # Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations)
  48. # And then will start Supervisor, which in turn will start Nginx and uWSGI
  49. CMD ["/start.sh"]