Skip to content

Commit 3f5f438

Browse files
vahdethaoqunjiang
authored andcommitted
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 69f7145)
1 parent 3da9008 commit 3f5f438

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/guide/deployment.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,16 @@ Deploy your application using nginx inside of a docker container.
439439
2. Create a `Dockerfile` file in the root of your project.
440440
441441
```Dockerfile
442-
FROM node:10
443-
COPY ./ /app
442+
FROM node:latest as build-stage
444443
WORKDIR /app
445-
RUN npm install && npm run build
444+
COPY package*.json ./
445+
RUN npm install
446+
COPY ./ .
447+
RUN npm run build
446448
447-
FROM nginx
449+
FROM nginx as production-stage
448450
RUN mkdir /app
449-
COPY --from=0 /app/dist /app
451+
COPY --from=build-stage /app/dist /app
450452
COPY nginx.conf /etc/nginx/nginx.conf
451453
```
452454

0 commit comments

Comments
 (0)