Skip to content

Commit 926d446

Browse files
author
Eyal Zekaria
committed
Update README.md
with an example on how to upgrade/downgrade yarn version
1 parent 838d873 commit 926d446

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/BestPractices.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
2929
ENV PATH=$PATH:/home/node/.npm-global/bin # optionally if you want to run npm global bin without specifying path
3030
```
3131

32+
## Upgrading/downgrading Yarn
33+
34+
If you need to upgrade/downgrade `yarn`, you can do so by issuing the following commands in your `Dockerfile`:
35+
36+
```Dockerfile
37+
FROM node:6
38+
39+
ENV YARN_VERSION 1.5.1
40+
41+
RUN curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
42+
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
43+
&& ln -snf /opt/yarn-v$YARN_VERSION /opt/yarn \
44+
&& rm yarn-v$YARN_VERSION.tar.gz
45+
```
46+
3247
## Handling Kernel Signals
3348

3449
Node.js was not designed to run as PID 1 which leads to unexpected behaviour when running inside of Docker. For example, a Node.js process running as PID 1 will not respond to `SIGTERM` (`CTRL-C`) and similar signals. As of Docker 1.13, you can use the `--init` flag to wrap your Node.js process with a [lightweight init system](https://github.com/krallin/tini) that properly handles running as PID 1.

0 commit comments

Comments
 (0)