1.6GB Docker Image, 8-Minute Builds. Add Runners?

Your image is huge and every code change rebuilds from scratch. A teammate wants to just add more CI runners. Defend how you actually fix it.

beginner8 min4 roundsEasy mode availableDockerCI/CD

Answer key reviewed by Branko Petric

Read first: Optimizing Docker Image Size and Build Speed

Your decision

Your Node app's Docker image is 1.6GB and every code change rebuilds dependencies from scratch, so CI takes 8 minutes. A teammate says just add more CI runners. How do you fix the image, and why?

The situation

Your team's Node service ships as a Docker image. The image is 1.6GB, and CI takes about 8 minutes per run because every commit reinstalls all dependencies before building.

Context

The Dockerfile starts from a full node base image, copies the whole project in one COPY, then runs npm install and the build. There is no .dockerignore. A teammate suggests just adding more CI runners so builds finish faster.

More: Docker scenario interview questions