Flexible Dockerized Phoenix Deployments (1.2 & 1.3)

Hi all, using Elixir 1.6.4/Phoenix 1.4.0-dev I’m having trouble in build.sh when running Dockerfile.build:

RUN npm i

gives me:

npm ERR! write after end
npm ERR! write after end
npm ERR! write after end
npm ERR! write after end
npm ERR! write after end

npm ERR! A complete log of this run can be found in:
npm ERR!     /opt/app/.npm/_logs/2018-07-11T01_15_54_198Z-debug.log
The command '/bin/sh -c npm i' returned a non-zero code: 1
Unable to find image 'dynt-build:latest' locally

So I tried fetching the latest npm which works but then it fails at the npm deploy step:

RUN npm i npm@latest -g

which now says webpack is missing(when it runs scripts in package.json):

  "scripts": {
    "deploy": "webpack --mode production",
    "watch": "webpack --mode development --watch"
  },
Step 7/13 : RUN npm i npm@latest -g
 ---> Running in bc37bb5a75b6
/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
/usr/bin/npx -> /usr/lib/node_modules/npm/bin/npx-cli.js
+ npm@6.1.0
added 228 packages from 48 contributors, removed 79 packages and updated 91 packages in 40.484s
Removing intermediate container bc37bb5a75b6
 ---> 55d96a8fc918
Step 8/13 : RUN npm run deploy
 ---> Running in b03b51c1621e

> @ deploy /opt/app/assets
> webpack --mode production

sh: webpack: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @ deploy: `webpack --mode production`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the @ deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /opt/app/.npm/_logs/2018-07-11T01_19_24_208Z-debug.log
The command '/bin/sh -c npm run deploy' returned a non-zero code: 1
Unable to find image 'dynt-build:latest' locally

But why? Shouldn’t webpack be present since I’m deploying via phoenix 1.4.0-dev which has webpack enabled by default?

I could avoid npm run deploy but then there will be no input path for RUN mix phx.digest:

 ---> Running in c4c306bea664
The input path "priv/static" does not exist

Which in turn breaks docker when the container needs to built from docker-compose up

Michael