Show HN: Comparing Docker minimal image size for a JSON API in various languages
andrew.marcuse.infoShow HN: Docker minimal image size comparison for a simple JSON API in various programming languages
I implemented a simple JSON API in multiple programming languages. It is interesting to compare the sizes of the resulting Docker images.
Optimizing the images can really reduce the sizes, especially for interpreted languages: while you would expect Go and Rust to be small (and they are: 9 MB & 5 MB respectively), Python and PHP are also surprisingly good: 60 MB and 51 MB.
Deno, Bun, NodeJS, .Net and Ruby are between 100 and 200 MB.
Ruby using bitami:ruby was over 500 MB. Switching to chainguard:ruby brought it down to 124 MB.
I haven't optimized the Swift, Perl, Java & Tcl images which are between 200 and 300 MB.
Proof that they actually run and work: https://www.regexplanet.com/status.html
Description of the API that they implement:
https://github.com/regexplanet/regexplanet-next/blob/main/CO... > Ruby using bitami:ruby was over 500 MB Oh my, half a gig!? Did you try to use Ruby:x-alpine? It's around 5 MB. Unless I’m missing something, you’re copying dev dependencies for bun, instead of prod ones. No, it is a multi-stage build. The second stage [1] uses oven/bun:distroless [1] https://github.com/regexplanet/regexplanet-bun/blob/main/Doc...