Minimal Docker Python Setup

screenshot of Minimal Docker Python Setup

A demo of a minimal Nginx-uWSGI-Flask-Redis stack using Docker in less than 42 mb.

Overview

This minimal Docker Python setup is a demonstration project that showcases a simplified stack using Nginx, uWSGI, Flask, and Redis. The architecture is designed to count the number of visits per IP address and store this data efficiently in Redis. One of the standout features of this Docker setup is its lightweight nature, making it an excellent choice for developers looking to experiment without consuming excessive resources. The entire setup runs using less than 45 MB of disk space, making it ideal for quick testing and learning purposes.

Setting up the environment involves creating images with Nginx and Redis and subsequently building the other images with Docker Compose. Users can quickly access the application at http://localhost:1337 to view the IP address count, all while benefiting from a custom image tailored for ease of use and performance.

Features

  • Lightweight Setup: Runs under 45 MB of disk space, ideal for minimal resource usage.
  • Multi-container Architecture: Utilizes three Docker containers for Nginx, the Flask app, and Redis, providing a clean separation of concerns.
  • Custom Images: Built on top of minimalistic base images, ensuring optimal performance and reduced overhead.
  • Visitor Counting: Efficiently counts visits per IP address, storing data in Redis for quick retrieval.
  • Dependency Management: Uses Wheel for Python dependency installation, allowing for easy handling of dependencies with C extensions.
  • Shared Libraries Integration: Ensures all necessary shared libraries for uWSGI are included, boosting compatibility and performance.
  • Flexible Environment: The use of Docker allows easy replication and modification of the setup according to user needs.
  • Open Source: Licensed under MIT, encouraging contributions and adaptations from the community.