DEV Community

Discussion on: Docker For Frontend Developers

Collapse
 
derek profile image
derek • Edited

Oh, also you can get more bang for your buck...

if you use

FROM node:8-alpine
Enter fullscreen mode Exit fullscreen mode

or

FROM gcr.io/distroless/nodejs
Enter fullscreen mode Exit fullscreen mode

Becasue... Size matters 😜, and so does security πŸ”’

Image Size
node:8 681MB
gcr.io/distroless/nodejs 76MB
node:8-alpine 69.7MB
Collapse
 
akanksha_9560 profile image
Aks

You are right Derek, slimming your images is important, but then i think that is an vast agenda having your multistage bulids, and trimming your code among other things :)

Collapse
 
derek profile image
derek

Indeed. But hypothetically if you could only do one thing, utilizing alpine or distroless is a low hanging fruit with a huge ROI.

Because, even if you do a multistage build without it you won't trim too much in comparison.

Image Size
node:8 681MB
node:8 with multi stage build 678MB

πŸ‘†πŸ½is a basic Hello World express app

Thread Thread
 
shindesharad71 profile image
SHARAD SHINDE

Docker Slim: Hold my beer πŸ˜…

Take a look at docker-slim - dockersl.im/

Thread Thread
 
derek profile image
derek

🍺held! Very cool

Confirmed! They've successfully implemented the middle-out compression πŸ˜†
confirmed

Collapse
 
slidenerd profile image
slidenerd

does it have node-gyp?