python3.7.dockerfile 1.9 KB

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