Edited Dockerfile of Docker(Nginx) deployment doc (#4561)

* Edited Dockerfile of Docker(Nginx) deployment doc

Edited `Dockerfile` section of https://cli.vuejs.org/guide/deployment.html#docker-nginx

As shown in [Vue v2 cookbook](https://vuejs.org/v2/cookbook/dockerize-vuejs-app.html) copying `package*.json` initially and running `npm install` in a separate step allows caching and reduces time elapsed during Docker build. Also the difference between the two docs will be reduced and be less confusing to those who end up with both of them.

* node version to latest

(cherry picked from commit 69f7145b02)
This commit is contained in:
vahdet
2019-09-21 17:17:12 +03:00
committed by Haoqun Jiang
parent 3da900813d
commit 3f5f438f7e

View File

@@ -439,14 +439,16 @@ Deploy your application using nginx inside of a docker container.
2. Create a `Dockerfile` file in the root of your project.
```Dockerfile
FROM node:10
COPY ./ /app
FROM node:latest as build-stage
WORKDIR /app
RUN npm install && npm run build
COPY package*.json ./
RUN npm install
COPY ./ .
RUN npm run build
FROM nginx
FROM nginx as production-stage
RUN mkdir /app
COPY --from=0 /app/dist /app
COPY --from=build-stage /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf
```