mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-02-28 19:38:43 -06:00
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:
@@ -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
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user