Skip to content

r1ckshot/MiniWeatherApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

☁️ MiniWeatherApp

A lightweight weather application built with Go and optimized for Docker. This project demonstrates Docker containerization with multi-stage builds and image optimization.

Note: Interface is in Polish.

✨ Features

  • 🌤️ Real-time Weather Data - Get current weather information using OpenWeatherMap API
  • 🌍 Multi-country Support - Works for cities in Poland, Germany, UK, and USA
  • 🐳 Docker Optimized - Ultra-small Docker image
  • 💪 Health Monitoring - Built-in health check endpoint
  • Fast & Lightweight - Written in Go for maximum performance
  • 🔒 Secure - Runs on minimal scratch base image

🛠️ Technologies

  • Backend: Go (Golang)
  • Frontend: HTML/CSS/JavaScript
  • Containerization: Docker
  • API: OpenWeatherMap API
  • Compression: UPX (Ultimate Packer for eXecutables)

🎯 Docker Optimization

  • Multi-stage build - Separate build and runtime stages
  • Static compilation - Go binary compiled with all dependencies
  • UPX compression - Executable compressed for minimal size
  • Scratch base image - Smallest possible base image (no OS!)
  • Health checks - Container health monitoring

Build Results

  • 📦 Image size: 4.44 MB
  • 📊 Layers: 3

🚀 Getting Started

Prerequisites

Quick Start with Docker

  1. Clone the repository

    git clone https://github.com/r1ckshot/MiniWeatherApp.git
    cd MiniWeatherApp
  2. Build the Docker image

    docker build -t weather-app:go .
  3. Run the container

    docker run -d -p 5000:5000 \
      -e WEATHER_API_KEY=your_api_key_here \
      --name weather-container \
      weather-app:go

    Note: Replace your_api_key_here with your actual OpenWeatherMap API key

  4. Access the application

    • Open your browser and navigate to: http://localhost:5000

Useful Docker Commands

# Check container logs
docker logs weather-container

# Check container health status
docker inspect weather-container | grep -A 10 "Health"

# View image details
docker image ls weather-app:go

# Check number of layers
docker image inspect weather-app:go --format='{{.RootFS.Layers}}' | wc -w

# Stop and remove container
docker stop weather-container
docker rm weather-container

📚 What I Learned

This project taught me important DevOps and backend development concepts:

  • Go programming language basics & HTTP server creation
  • Docker containerization
  • Multi-stage Docker builds
  • Image size reduction techniques
  • Container health monitoring
  • API integration and environment variables
  • Static binary compilation

👨‍💻 Author

Mykhailo Kapustianyk

About

Lightweight weather application built with Go and optimized for Docker

Topics

Resources

Stars

Watchers

Forks

Contributors