mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 05:37:53 +00:00
Dockerfile: improve caching by installing devDependencies before copying the code
This should help avoid having to run the npm install for devDependencies (which are actually most of the modules) every time there's a change in the code. Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
b000c0c9ee
commit
12ab5c16ea
11
Dockerfile
11
Dockerfile
@ -142,16 +142,17 @@ RUN mkdir -p rootfs-overlay && \
|
||||
COPY package.json /usr/src/app/
|
||||
|
||||
# Install only the production modules that have C extensions
|
||||
# Save the modules and then install devDependencies for build
|
||||
RUN JOBS=MAX npm install --production --no-optional --unsafe-perm \
|
||||
&& npm dedupe
|
||||
&& npm dedupe \
|
||||
&& cp -R node_modules node_modules_prod \
|
||||
&& npm install --no-optional --unsafe-perm
|
||||
|
||||
COPY webpack.config.js fix-jsonstream.js /usr/src/app/
|
||||
COPY src /usr/src/app/src
|
||||
|
||||
# Install devDependencies, build the coffeescript and then prune the deps
|
||||
RUN cp -R node_modules node_modules_prod \
|
||||
&& npm install --no-optional --unsafe-perm \
|
||||
&& npm run lint \
|
||||
# Build the coffeescript and then restore the production modules
|
||||
RUN npm run lint \
|
||||
&& npm run build \
|
||||
&& rm -rf node_modules \
|
||||
&& mv node_modules_prod node_modules
|
||||
|
Loading…
Reference in New Issue
Block a user