-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Update Dockerizing guide to adhere to best practice #2293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/ping @nodejs/docker |
|
||
```docker | ||
CMD [ "npm", "start" ] | ||
CMD [ "node", "server.js" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking perhaps but maybe this should be script.js
or index.js
since not every node app is a server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Laurent, thanks for the feedback. It should stay as-is because the guide, as it is written today, is a step-by-step guide that explicitly sets up a server and instructs the reader to create server.js
. This PR is simply updating the pattern in the code without changing the scope of guide itself. Here's a link to the guide for reference.
available from the [Docker Hub](https://hub.docker.com/): | ||
|
||
```docker | ||
FROM node:8 | ||
FROM node:10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be node:lts
instead of hard coding a version number, not sure if it should be recommended or not, though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it should not. It's problematic in the same way latest
is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're currently having this discussion in PR #2953. Can you elaborate on this? I clearly see there might be issues using the latest
tag, but I don't understand in what way this might be problematic in the same way latest
would be.
Is this good to go? 🚀 |
Hey y'all,
TL;DR - This PR updates the Dockerizing a Node.js web app guide to adhere to an official best practice of using
node server.js
instead ofnpm start
inside of a Docker container.Longer version:
The current Dockerizing a Node.js web app guide links to the official Node.js Docker Best Practices Guide that currently recommends avoiding the use of
npm start
for two reasons:SIGTERM
andSIGINT
to be received by the Node.js process instead of npm swallowing them.There are currently ~54,000 public
Dockerfile
s on GitHub not following this practice.This PR updates the former guide to adhere to latter guide's best practice.
Additionally, the guide references "latest LTS" that points to
8
, this updates that to10
Additional Question:
How should I handle translations? The translation guide in this repo doesn't seem to apply to the guides pages, so I didn't update the corresponding paragraph of text for the locales that weren't already english.