Docker Build Times: From 8 Minutes to 40 Seconds
Our CI pipeline was embarrassing. Every PR took 8+ minutes to build a Docker image for a Next.js app. Developers complained. I ignored them for two months because “it’s just CI, ship faster code.” Then we hit 50+ PRs per day and our CI bill jumped $400/month. Time to actually fix it. The original Dockerfile (the bad one) FROM node:18 WORKDIR /app COPY . . RUN npm install RUN npm run build CMD ["npm", "start"] Looks innocent. Builds every time though. Every. Single. Time. ...



