Skip to content

Commit 69f7145

Browse files
vahdetNataliaTepluhina
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
1 parent 9c99ce2 commit 69f7145

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
@@ -395,14 +395,16 @@ Deploy your application using nginx inside of a docker container.
395395
2. Create a `Dockerfile` file in the root of your project.
396396
397397
```Dockerfile
398-
FROM node:10
399-
COPY ./ /app
398+
FROM node:latest as build-stage
400399
WORKDIR /app
401-
RUN npm install && npm run build
400+
COPY package*.json ./
401+
RUN npm install
402+
COPY ./ .
403+
RUN npm run build
402404
403-
FROM nginx
405+
FROM nginx as production-stage
404406
RUN mkdir /app
405-
COPY --from=0 /app/dist /app
407+
COPY --from=build-stage /app/dist /app
406408
COPY nginx.conf /etc/nginx/nginx.conf
407409
```
408410

0 commit comments

Comments
 (0)