We reduced a real Node.js production Docker image from 1.2GB to 78MB

(the-practical-developer.online)

26 points | by milkikomasiko 1 hour ago

7 comments

  • 1a527dd5 1 hour ago
    • simondotau 38 minutes ago
      Yep, it’s also AI slop. @dang ?
  • tpaksoy 1 hour ago
    We had issues running our Node app on alpine. Specifically the dns lookup for our API calls were taking several hundred milliseconds *every* time.

    Switching to debian reduced it to microseconds.

    Does anyone here know what I was doing wrong with alpine?

    • ashishb 1 hour ago
      Alpine is a bad idea for a non-trivial application written in Python, Node.js, or any other interpreted language.

      Too many weird edge cases to deal with, especially related to Alpine using musl libc instead of glibc.

      At best, your builds are slower.

      At worst, certain code paths are broken.

      • stavros 48 minutes ago
        I had this experience as well, nowadays I use Debian slim. Too much random breakage in Alpine.
    • Tiberium 1 hour ago
      Musl is much less optimized than glibc, random example: https://andygrove.io/2020/05/why-musl-extremely-slow/
  • Eighth 47 minutes ago
    Good post. Using slim is the easiest and biggest impact change.
  • coolThingsFirst 55 minutes ago
    Ditch docker and use Golang to bring it to 4MB.
    • stavros 47 minutes ago
      Ditch Golang and use a textfile containing the text "Hello world!" to bring it to 12 bytes.
  • wxw 48 minutes ago
    This website seems entirely filled with AI slop articles targeted towards software eng.
  • hottrends 1 hour ago
    [flagged]