Dockerizing Flask For Production

Thursday, 02 December, 04:30PM – 04:55PM (UTC)

Learn to Dockerize your Flask application. We will create a basic Flask app, set up uWSGI, serve the website with Nginx, and install an SSL certificate inside Docker. With this tutorial, you will be able to reuse your scripts with your Flask project, making deployment a breeze.

Part 1 - Flask App: Creating a basic Flask application that will display dynamic data as well as serve static images. Showing that this example can be used in all use cases. Part 2 - Docker: This part will show how to set up Docker and create your very own docker image from the Flask app and run it. We will also set up environment variables to set different entry points to our application to run in development (with debug mode) and in production. That way, you do not need to change your setup every time you update your app. Part 3 - uWSGI: Here we will learn what a WSGI server is, how to set up uWSGI for our application, and how to make sure it runs in Docker. Part 4 - Docker Compose w/ Nginx & Database: Now we will take everything we learned and use Docker Compose to run our application with one command. Here we will also set up the Nginx proxy manager to serve our website and a Database (required by the Nginx proxy manager). You will also learn how you can run multiple applications on the same port using the proxy manager. With this method, you would be able to run Flask in the back-end and any front-end library such as React altogether or multiple Flask applications.

Nico Plyley

FlaskCon Speaker