A 3-tier containerized web application demonstrating core DevOps practices.
Browser → Nginx (80) → Flask (5000) → PostgreSQL (5432)
Proxy Web App Database
# Clone the repo
git clone https://github.com/zeroxin2003/project-01-flask-docker.git
cd project-01-flask-docker
# Start all services
docker compose up -d --build
# Visit http://localhost| Component | Tech | Purpose |
|---|---|---|
| Reverse Proxy | Nginx Alpine | SSL termination, load balancing ready |
| Web App | Flask 3.1 + Python 3.12 | Application logic |
| Database | PostgreSQL 16 Alpine | Persistent data storage |
| Orchestration | Docker Compose | Multi-container management |
- Health checks on all 3 services with proper startup ordering
- Persistent data via named Docker volume (
db_data) - Nginx reverse proxy hides internal Flask port from external access
- Environment variables for database configuration (no hardcoded secrets)
- Layer-optimized Dockerfile (requirements.txt copied before code for cache efficiency)
# Start services
docker compose up -d --build
# Check service status and health
docker compose ps
# View logs
docker compose logs -f
# Stop and remove containers (data preserved)
docker compose down
# Stop and remove containers + data
docker compose down -v
# Restart a single service
docker compose restart web- Containerization — Each service runs in its own isolated container
- Docker Compose networking — Services communicate by service name
- Volume persistence — Database survives container restarts
- Reverse proxy pattern — Nginx as single entry point
- Health checks —
depends_onwithcondition: service_healthyensures correct startup order - Layer caching — Dockerfile copies
requirements.txtbefore source code - Environment-based config — Database credentials via environment variables
├── app.py # Flask application
├── requirements.txt # Python dependencies
├── Dockerfile # Flask container build
├── docker-compose.yml # Multi-service orchestration
├── nginx/
│ └── default.conf # Nginx reverse proxy config
├── .dockerignore
└── .gitignore