Skip to content

Commit

Permalink
zh-CN:Trans for 'nodejs-docker-webapp.md' (#2083)
Browse files Browse the repository at this point in the history
Ref:#2080.
  • Loading branch information
Maledong authored and ZYSzys committed Feb 16, 2019
1 parent b6f51eb commit 8b27598
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 8b27598

Please sign in to comment.