Skip to content

Commit

Permalink
Merge pull request nodejs#2056 from grjan7/main
Browse files Browse the repository at this point in the history
docs: added punctuation
  • Loading branch information
SimenB committed Apr 5, 2024
2 parents b016843 + 47b3109 commit ba5213b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ $ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/sr

### Verbosity

Prior to 8.7.0 and 6.11.4 the docker images overrode the default npm log
level from `warn` to `info`. However due to improvements to npm and new Docker
Prior to 8.7.0 and 6.11.4, the docker images overrode the default npm log
level from `warn` to `info`. However, due to improvements to npm and new Docker
patterns (e.g. multi-stage builds) the working group reached a [consensus](https://github.com/nodejs/docker-node/issues/528)
to revert the log level to npm defaults. If you need more verbose output, please
use one of the following methods to change the verbosity level.

#### Dockerfile

If you create your own `Dockerfile` which inherits from the `node` image you can
If you create your own `Dockerfile` which inherits from the `node` image, you can
simply use `ENV` to override `NPM_CONFIG_LOGLEVEL`.

```dockerfile
Expand All @@ -130,7 +130,7 @@ ENV NPM_CONFIG_LOGLEVEL info

#### Docker Run

If you run the node image using `docker run` you can use the `-e` flag to
If you run the node image using `docker run`, you can use the `-e` flag to
override `NPM_CONFIG_LOGLEVEL`.

```console
Expand All @@ -139,7 +139,7 @@ $ docker run -e NPM_CONFIG_LOGLEVEL=info node ...

#### NPM run

If you are running npm commands you can use `--loglevel` to control the
If you are running npm commands, you can use `--loglevel` to control the
verbosity of the output.

```console
Expand Down
14 changes: 7 additions & 7 deletions docs/BestPractices.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ENV PATH=$PATH:/home/node/.npm-global/bin # optionally if you want to run npm gl

If you need to upgrade/downgrade `yarn` for a local install, you can do so by issuing the following commands in your `Dockerfile`:

> 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.
> 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.
> When following the local install instructions, due to duplicated yarn the image will end up being bigger.
Expand Down Expand Up @@ -115,7 +115,7 @@ USER node

Note that the `node` user is neither a build-time nor a run-time dependency and it can be removed or altered, as long as the functionality of the application you want to add to the container does not depend on it.

If you do not want nor need the user created in this image you can remove it with the following:
If you do not want nor need the user created in this image, you can remove it with the following:

```Dockerfile
# For debian based images use:
Expand All @@ -125,13 +125,13 @@ RUN userdel -r node
RUN deluser --remove-home node
```

If you need to change the uid/gid of the user you can use:
If you need to change the uid/gid of the user, you can use:

```Dockerfile
RUN groupmod -g 999 node && usermod -u 999 -g 999 node
```

If you need another name for the user (ex. `myapp`) execute:
If you need another name for the user (ex. `myapp`), execute:

```Dockerfile
RUN usermod -d /home/myapp -l myapp node
Expand All @@ -147,15 +147,15 @@ RUN deluser --remove-home node \

## Memory

By default, any Docker Container may consume as much of the hardware such as CPU and RAM. If you are running multiple containers on the same host you should limit how much memory they can consume.
By default, any Docker Container may consume as much of the hardware such as CPU and RAM. If you are running multiple containers on the same host, you should limit how much memory they can consume.

```
-m "300M" --memory-swap "1G"
```

## CMD

When creating an image, you can bypass the `package.json`'s `start` command and bake it directly into the image itself. First off this reduces the number of processes running inside of your container. Secondly it causes exit signals such as `SIGTERM` and `SIGINT` to be received by the Node.js process instead of npm swallowing them.
When creating an image, you can bypass the `package.json`'s `start` command and bake it directly into the image itself. First off, this reduces the number of processes running inside of your container. Secondly, it causes exit signals such as `SIGTERM` and `SIGINT` to be received by the Node.js process instead of npm swallowing them.

```Dockerfile
CMD ["node","index.js"]
Expand Down Expand Up @@ -192,7 +192,7 @@ RUN apk add --no-cache --virtual .gyp python3 make g++ \
&& apk del .gyp
```

And Here's a multistage build example
And, here's a multistage build example:

```Dockerfile
FROM node:alpine as builder
Expand Down

0 comments on commit ba5213b

Please sign in to comment.