A minimal, ultra-lightweight HTTP web server written in Go using the scratch Docker base image for production-ready containerization.
This project demonstrates a simple HTTP server built with Go and deployed using the scratch base image—the most minimal container base available. Unlike traditional distroless images (which still contain minimal utilities), scratch is completely empty: it contains nothing but your application binary. This results in the smallest possible container images with zero OS overhead.
- Barebone: Uses scratch base image—the absolute minimum container
- Ultra-Lightweight: Typical image size: 10-20 MB (vs 800+ MB for full OS)
- Zero Attack Surface: No OS exploits possible—no shell to exploit
- Multi-stage Build: Compiles in Go environment, deploys minimal binary
- Production-Ready: Secure and optimized for containerization
- Static Binary: Go app compiled as self-contained executable
To run this project, you need:
- Go 1.25.0+ (for local development)
- Docker (for containerized deployment)
- Docker Compose (for orchestrated deployment)
docker build -t go-distroless:latest .docker run -p 80:80 go-distroless:latestStart the service:
docker-compose upStop the service:
docker-compose downView logs:
docker-compose logs -f- GET / - Returns a simple HTML welcome page with "Hello, World!"
curl http://localhost:80
# Output: <h1>Hello, World!</h1>The distroless approach provides:
- Smaller Image Size: Typically 10-20 MB vs 800+ MB for full OS images
- Reduced Attack Surface: No shell, package managers, or unnecessary utilities
- Faster Startup: Minimal dependencies to load
MIT License - feel free to use this project for learning and development.