You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/BestPractices.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ ENV PATH=$PATH:/home/node/.npm-global/bin # optionally if you want to run npm gl
44
44
45
45
If you need to upgrade/downgrade `yarn` for a local install, you can do so by issuing the following commands in your `Dockerfile`:
46
46
47
-
> 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.
47
+
> 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.
48
48
49
49
> When following the local install instructions, due to duplicated yarn the image will end up being bigger.
50
50
@@ -115,7 +115,7 @@ USER node
115
115
116
116
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.
117
117
118
-
If you do not want nor need the user created in this image you can remove it with the following:
118
+
If you do not want nor need the user created in this image, you can remove it with the following:
119
119
120
120
```Dockerfile
121
121
# For debian based images use:
@@ -125,13 +125,13 @@ RUN userdel -r node
125
125
RUN deluser --remove-home node
126
126
```
127
127
128
-
If you need to change the uid/gid of the user you can use:
128
+
If you need to change the uid/gid of the user, you can use:
If you need another name for the user (ex. `myapp`) execute:
134
+
If you need another name for the user (ex. `myapp`), execute:
135
135
136
136
```Dockerfile
137
137
RUN usermod -d /home/myapp -l myapp node
@@ -147,15 +147,15 @@ RUN deluser --remove-home node \
147
147
148
148
## Memory
149
149
150
-
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.
150
+
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.
151
151
152
152
```
153
153
-m "300M" --memory-swap "1G"
154
154
```
155
155
156
156
## CMD
157
157
158
-
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.
158
+
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.
159
159
160
160
```Dockerfile
161
161
CMD ["node","index.js"]
@@ -192,7 +192,7 @@ RUN apk add --no-cache --virtual .gyp python3 make g++ \
0 commit comments