Roba Nath Basnet’s Post

400MB → 2GB. Six months. Zero code changes. CI: 3min → 20min. One Dockerfile. All of it. ANSWER: (D) Multi-stage builds Before (1.5–2GB): FROM node:22 # 1.1GB base COPY . . RUN npm install # ships dev deps too After (250–350MB): FROM node:22-alpine AS builder WORKDIR /app COPY package*.json . RUN npm ci --only=production COPY . . FROM node:22-alpine WORKDIR /app COPY --from=builder /app/node_modules . COPY --from=builder /app/src . CMD ["node", "src/app.js"] 75% smaller. One change. 5 FIXES RANKED BY IMPACT: 1️⃣ Multi-stage — 50–75% smaller 2️⃣ Alpine base — saves 900MB 3️⃣ Prod deps only — saves 300MB 4️⃣ .dockerignore — saves GBs 5️⃣ Layer ordering — faster CI DIAGNOSE:  docker history myimage:latest  docker run --rm -it wagoodman/dive myimage:latest Ship fast. Then fix the Dockerfile. Biggest image you inherited? 👇 #Docker #DevOps #CICD #30DaysOfDevOps

To view or add a comment, sign in

Explore content categories