The npm install commands in the Dockerfile don't remove the npm cache files.
The cached files become stale as the image ages and likely unused.
This resulting an image size being increase by over 1GB with internal testing:
2.455GB -> 1.359GB
|
RUN npm i --location=global gulp-cli@3 yo pnpm |
|
RUN npm i --location=global @microsoft/generator-sharepoint@1.21.1 |
Have tested image change with project builds including in #114
Potential Solution:
Clear the cache after the package installs:
RUN npm i --location=global gulp-cli@3 yo pnpm \
&& npm i --location=global @microsoft/generator-sharepoint@1.21.1 \
&& npm cache clean --force
- RUN npm i --location=global gulp-cli@3 yo pnpm
- RUN npm i --location=global @microsoft/generator-sharepoint@1.21.1
+ RUN npm i --location=global gulp-cli@3 yo pnpm \
+ && npm i --location=global @microsoft/generator-sharepoint@1.21.1 \
+ && npm cache clean --force
Note that clearing the cache in a separate layer (subsequent command) will not decrease the image's size.
The
npm installcommands in the Dockerfile don't remove the npm cache files.The cached files become stale as the image ages and likely unused.
This resulting an image size being increase by over 1GB with internal testing:
docker-spfx/Dockerfile
Lines 16 to 17 in 9248280
Potential Solution:
Clear the cache after the package installs:
RUN npm i --location=global gulp-cli@3 yo pnpm \ && npm i --location=global @microsoft/generator-sharepoint@1.21.1 \ && npm cache clean --force