Skip to content

Commit 14833de

Browse files
Merge pull request #1124 from LaurentGoderre/pull-1042
Update Upgrading/downgrading Yarn best practice
2 parents 70431ea + e18668a commit 14833de

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

docs/BestPractices.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,28 @@ ENV PATH=$PATH:/home/node/.npm-global/bin # optionally if you want to run npm gl
3232

3333
## Upgrading/downgrading Yarn
3434

35-
If you need to upgrade/downgrade `yarn`, you can do so by issuing the following commands in your `Dockerfile`:
35+
### Local
36+
37+
If you need to upgrade/downgrade `yarn` for a local install, you can do so by issuing the following commands in your `Dockerfile`:
38+
39+
> Note that if you create some other directory which is not a descendant one from where you ran the command, you will end up using the global (dated) version. If you wish to upgrade `yarn` globally follow the instructions in the next section.
40+
41+
> When following the local install instructions, due to duplicated yarn the image will end up being bigger.
3642
3743
```Dockerfile
3844
FROM node:6
3945

40-
ENV YARN_VERSION 1.5.1
46+
ENV YARN_VERSION 1.16.0
47+
48+
RUN yarn policies set-version $YARN_VERSION
49+
```
50+
51+
### Global
52+
53+
```Dockerfile
54+
FROM node:6
55+
56+
ENV YARN_VERSION 1.16.0
4157

4258
RUN curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
4359
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \

0 commit comments

Comments
 (0)