Skip to content

About

๐Ÿš€ A lightweight Go calculator app containerized with multistage Docker builds for maximum size reduction using distroless image ๐Ÿณ๐Ÿ“ฆ "for Analysis"

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Size-Reduction-Distroless-img

A lightweight, interactive Go calculator CLI app containerized using a multi-stage Docker build โ€” reducing image size from 854MB to just 1.9MB using the scratch base image ๐Ÿณ๐Ÿ“‰.


๐Ÿงฎ About the App

This is a simple command-line calculator written in Go (calculator.go). It supports basic arithmetic operations (+, -, *, /) and takes user input in the format:

๐Ÿณ Dockerized with Multi-stage Build

The project uses a two-stage Docker build:

  1. Stage 1: Compiles the Go binary using the full Golang environment.
  2. Stage 2: Copies only the compiled binary into a scratch image, resulting in an extremely small final image.

๐Ÿ”ง How to Build & Run

โœ… At first Build in main repo

docker build -t go-calculator .

โœ… At second Build in without the multistage repo

docker build -t reduced-calculator .

โœ… Check the docker images size

docker images

๐Ÿ“ฆ Image Size Comparison

Docker Image Base Image Size
ubuntu (single stage) 854 MB
scratch (multistage) 1.9 MB โœ…

About

๐Ÿš€ A lightweight Go calculator app containerized with multistage Docker builds for maximum size reduction using distroless image ๐Ÿณ๐Ÿ“ฆ "for Analysis"

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages