<p>I am migrating an application in Nodejs to kubernetes in GCP. In CI tutorials, I see the updated application being copied to a new docker image and sent to GCR.</p>

<p>The process of uploading an image is slow compared to updating only the code. So what exactly is the gain of sending a new image containing the application?</p>

Emerson MS
<p>The philosophy of Docker is simple - layers are reusable [1]. As long as the layers have not changed, they are reused across images. As long as you keep your application's layer as the last few, the base layers can be reused, keeping the number of layers pushed to a minimum. You should consider using multi-stage builds to minimise shipping build-stage dependencies with your container. Hasura.io has an excellent post[2] on using multi-stage builds for NodeJS apps effectively. </p>

<ol>
<li><a href="https://www.infoworld.com/article/3077875/linux/containers-101-docker-fundamentals.html" rel="nofollow noreferrer">https://www.infoworld.com/article/3077875/linux/containers-101-docker-fundamentals.html</a></li>
<li><a href="https://blog.hasura.io/an-exhaustive-guide-to-writing-dockerfiles-for-node-js-web-apps-bbee6bd2f3c4" rel="nofollow noreferrer">https://blog.hasura.io/an-exhaustive-guide-to-writing-dockerfiles-for-node-js-web-apps-bbee6bd2f3c4</a></li>
</ol>
