Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions locale/zh-cn/docs/guides/nodejs-docker-webapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm install --only=production
# RUN npm ci --only=production
```

请注意,我们只是拷贝了 `package.json` 文件而非整个工作目录。这允许我们利用缓存 Docker 层的优势。bitJudo 对此有一个很好的解释,请 [见此](http://bitjudo.com/blog/2014/03/13/building-efficient-dockerfiles-node-dot-js/)。
进一步说,对于生产环境而言,注释中提及的 `npm ci` 命令协助提供了一个更快、可靠、可再生的构建环境。欲知详情,可以参考[此处](https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable)。

在 Docker 镜像中使用 `COPY` 命令绑定你的应用程序:

Expand Down Expand Up @@ -129,7 +130,7 @@ COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm install --only=production
# RUN npm ci --only=production

# Bundle app source
COPY . .
Expand Down