Merge pull request #14006 from brethubbard/add-multi-stage-build-instructions

add instructions for a multi-stage build dockerfile
This commit is contained in:
Patrik Oldsberg
2022-10-09 23:59:21 +02:00
committed by GitHub
+7
View File
@@ -67,6 +67,13 @@ COPY .yarn ./.yarn
COPY .yarnrc.yml ./
```
In a multi-stage `Dockerfile`, each stage that runs a `yarn` command will also need the Yarn 3 installation. For example, in the final stage you may need to add the following:
```Dockerfile
COPY --from=build --chown=node:node /app/.yarn ./.yarn
COPY --from=build --chown=node:node /app/.yarnrc.yml ./
```
The `--production` flag to `yarn install` has been removed in Yarn 3, instead you need to use `yarn workspaces focus --all --production` to avoid installing development dependencies in your production deployment. A tradeoff of this is that `yarn workspaces focus` does not support the `--immutable` flag.
```Dockerfile