New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(deployment): prune non-production deps #23056
Conversation
added the following line, to remove the size of the `runner` (production) image. This will remove the `devDependencies` from the container after `next build` completes. ``` yarn install --production --ignore-scripts --prefer-offline ``` For the typescript starter, this is the change in size | before <br/>proposed change<br/>size in bytes | after <br/> proposed change <br/> size in bytes| |----|---| | 347MB | 176MB |
docs/deployment.md
Outdated
@@ -98,7 +98,8 @@ FROM node:alpine AS builder | |||
WORKDIR /app | |||
COPY . . | |||
COPY --from=deps /app/node_modules ./node_modules | |||
RUN yarn build | |||
RUN yarn build \ | |||
yarn install --production --ignore-scripts --prefer-offline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we really just need --production
here? Why the others? Can we also keep on one line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the additional flags because I followed the recommendation in this GitHub issue:
yarnpkg/yarn#696 (comment)
Here's the comment for convenience:
yarn install --production is close, but it does a few things prune doesn't. It's a little annoying to have to build native modules twice in a CI pipeline just to prune. You can prevent rebuilding packages that already exist in cache with the --ignore-scripts flag. Additionally, prune doesn't check npm registry, so add --prefer-offline.
So, yarn install --production --ignore-scripts --prefer-offline == npm prune --productio
added the following line, to remove the size of the `runner` (production) image. This will remove the `devDependencies` from the container after `next build` completes. ``` yarn install --production --ignore-scripts --prefer-offline ``` For the typescript starter, this is the change in size | before <br/>proposed change<br/>size in bytes | after <br/> proposed change <br/> size in bytes| |----|---| | 347MB | 176MB |
added the following line, to remove the size of the
runner
(production) image. This will remove thedevDependencies
from the container afternext build
completes.For the typescript starter, this is the change in size
proposed change
size in bytes
proposed change
size in bytes