title: Running NodeJs binary with scratch Docker image
body: <p>We can convert NodeJs applications into binaries with the <a href="https://www.npmjs.com/package/pkg" rel="nofollow noreferrer"><code>pkg</code> package</a>. I want to build the binary and run the same with the Docker <code>scratch</code> image.</p>
  
  <p><code>index.js</code></p>
  
  <pre class="lang-js prettyprint-override"><code>const http = require('http')
  http.createServer().listen(3000)
  </code></pre>
  
  <p><code>Dockerfile</code></p>
  
  <pre><code>FROM node:10 as build
  
  COPY index.js .
  RUN npm i pkg -g &amp;&amp; pkg -t node10-alpine-x64 index.js
  
  FROM scratch
  COPY --from=build index /index
  
  ENTRYPOINT ["/index"]
  </code></pre>
  
  <p>When I run <code>docker build -t index . &amp;&amp; docker run --rm -it index</code>, I get this error message - <code>standard_init_linux.go:211: exec user process caused "no such file or directory"</code>.</p>
  
  <p>What am I missing?</p>