DAY 30 π€οΈ Weather App (Dockerized Flask + Nginx)


A simple weather app built with Flask and served via Nginx using Docker Compose. Enter a city name and get real-time weather data fetched from the OpenWeatherMap API.
π Project Structure
weather-app/
β
βββ app/
β βββ app.py # Flask app
β βββ requirements.txt # Python dependencies
β
βββ frontend/
β βββ index.html # Simple HTML frontend
β
βββ nginx/
β βββ default.conf # Nginx reverse proxy config
β
βββ Dockerfile # Flask Docker image
βββ docker-compose.yml # Docker Compose setup
βββ README.md # Project documentation
π Features
π Python Flask backend
π Nginx as a reverse proxy
π³ Docker + Docker Compose support
π Realtime weather data using OpenWeatherMap
π» Clean and simple frontend UI
βοΈ Setup Instructions
1. π§° Prerequisites
Make sure you have:
Docker installed
Docker Compose installed
An API key from OpenWeatherMap
2. π οΈ Clone the Repo
git clone https://github.com/yourusername/weather-app.git
cd weather-app
3. π Configure Environment
Create a .env
file in the project root:
API_KEY=your_openweathermap_api_key_here
4. π¦ Build & Run Containers
docker-compose up --build
Access the app at: http://localhost
5. π§ͺ Example Usage
Open the browser.
Type
Mumbai
orNew York
in the input box.Click Get Weather to see real-time weather.
π Tech Stack
Tool | Purpose |
Flask | Python Web Framework |
OpenWeatherMap | Weather API Provider |
Nginx | Reverse Proxy |
Docker | Containerization |
Docker Compose | Multi-container setup |
HTML/CSS | Frontend UI |
π§Ή Cleanup
To stop and remove containers:
docker-compose down
π Notes
For production, use Gunicorn instead of Flask's development server.
Add error handling and input validation for better UX.
π Acknowledgments
Docker & Flask Communities
π Connect with Me
GitHub: ritesh355
LinkedIn: Ritesh Singh
Blog: Hashnode
Subscribe to my newsletter
Read articles from Ritesh Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Ritesh Singh
Ritesh Singh
Hi, Iβm Ritesh π Iβm on a mission to become a DevOps Engineer β and Iβm learning in public every single day.With a full-time commitment of 8β10 hours daily, Iβm building skills in: β Linuxβ Git & GitHubβ Docker & Kubernetesβ AWS EC2, S3β Jenkins, GitHub Actionsβ Terraform, Prometheus, Grafana I post daily blogs on Hashnode, push projects to GitHub, and stay active on LinkedIn and Twitter/X. Letβs connect, collaborate, and grow together π #100DaysOfDevOps #LearningInPublic #DevOps