From 96739bf2df03bb0e73e9a19293a4a4f091f2d8f7 Mon Sep 17 00:00:00 2001 From: vahdet Date: Tue, 10 Sep 2019 16:09:48 +0300 Subject: [PATCH 1/2] 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. --- docs/guide/deployment.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index 1d648fae9a..f5736e6f88 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -395,14 +395,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:10 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 ``` From 977944c810beeae67f3c5b4ad07c108604f8aec6 Mon Sep 17 00:00:00 2001 From: vahdet Date: Mon, 16 Sep 2019 15:18:54 +0300 Subject: [PATCH 2/2] node version to latest --- docs/guide/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index f5736e6f88..1d60bc004b 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -395,7 +395,7 @@ 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 as build-stage + FROM node:latest as build-stage WORKDIR /app COPY package*.json ./ RUN npm install