The Last Dockerfile You Need for NestJS

<h1>The &ldquo;dev&rdquo; Stage</h1> <p>It&rsquo;s fairly straightforward. All we need to do is to install npm dependencies and apply some of the&nbsp;<a href="https://docs.docker.com/develop/" rel="noopener ugc nofollow" target="_blank">best practices</a>:</p> <ul> <li>We&rsquo;ll use &ldquo;<a href="https://hub.docker.com/_/node" rel="noopener ugc nofollow" target="_blank">node:alpine</a>&rdquo; as the based image to produce minimal image size.</li> <li>We&rsquo;ll install&nbsp;<a href="https://github.com/nodejs/docker-node#nodealpine" rel="noopener ugc nofollow" target="_blank">missing shared libraries</a>&nbsp;from node:alpine.</li> <li>We&rsquo;ll assign a&nbsp;<a href="https://docs.docker.com/engine/reference/builder/#user" rel="noopener ugc nofollow" target="_blank">non-root user</a>&nbsp;to Docker to limit its privileges</li> <li>We&rsquo;ll set the environment to &ldquo;development&rdquo;.</li> <li>We&rsquo;ll install the dependencies based on&nbsp;<a href="https://classic.yarnpkg.com/lang/en/docs/yarn-lock/" rel="noopener ugc nofollow" target="_blank">yarn lock file</a>&nbsp;to achieve consistent installation across machines.</li> </ul> <p><a href="https://levelup.gitconnected.com/the-last-dockerfile-you-need-for-nestjs-76cbfe1edf48"><strong>Click Here</strong></a></p>