Merge pull request #313 from resin-io/dont-npm-install-twice

Avoid installing npm dependencies twice
This commit is contained in:
Pablo Carranza Vélez 2016-10-10 18:56:20 -03:00 committed by GitHub
commit a2df8c513a
2 changed files with 9 additions and 8 deletions

View File

@ -1,3 +1,4 @@
* Avoid installing npm dependencies twice [Pablo]
* Updated to bluebird 3 [Page]
* Better parameter handling in PUT /v1/devices/:uuid [Pablo]
* An update hook response of 200 will cause the proxyvisor to stop pinging the hook [Pablo]

View File

@ -40,17 +40,17 @@ RUN set -x \
COPY package.json /usr/src/app/
# First install devDependencies too in order to run the build
RUN JOBS=MAX npm install --unsafe-perm
# Install only the production modules
RUN JOBS=MAX npm install --production --no-optional --unsafe-perm \
&& npm dedupe
COPY src /usr/src/app/src
RUN npm run lint \
&& npm run build
# Re-install just production modules. This should be fast due to npm cache from previous layer
RUN rm -rf node_modules \
&& JOBS=MAX npm install --unsafe-perm --production --no-optional \
# Install devDependencies, build the coffeescript and then prune the deps
RUN npm install --only=dev --no-optional --unsafe-perm \
&& npm run lint \
&& npm run build \
&& npm prune --production \
&& npm dedupe
# Remove various uneeded filetypes in order to reduce space