Avoid installing npm dependencies twice

This commit is contained in:
Pablo Carranza Velez 2016-10-10 19:29:56 +00:00
parent dc59197a01
commit 2413f5cff1
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