File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -90,10 +90,11 @@ COPY package*.json ./
9090
9191RUN npm install
9292# If you are building your code for production
93- # RUN npm install --only=production
93+ # RUN npm ci --only=production
9494```
9595
9696请注意,我们只是拷贝了 ` package.json ` 文件而非整个工作目录。这允许我们利用缓存 Docker 层的优势。bitJudo 对此有一个很好的解释,请 [ 见此] ( http://bitjudo.com/blog/2014/03/13/building-efficient-dockerfiles-node-dot-js/ ) 。
97+ 进一步说,对于生产环境而言,注释中提及的 ` npm ci ` 命令协助提供了一个更快、可靠、可再生的构建环境。欲知详情,可以参考[ 此处] ( https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable ) 。
9798
9899在 Docker 镜像中使用 ` COPY ` 命令绑定你的应用程序:
99100
@@ -129,7 +130,7 @@ COPY package*.json ./
129130
130131RUN npm install
131132# If you are building your code for production
132- # RUN npm install --only=production
133+ # RUN npm ci --only=production
133134
134135# Bundle app source
135136COPY . .
You can’t perform that action at this time.
0 commit comments