From afeb258f248e3ffa6f920d51b3ad681919d38c0c Mon Sep 17 00:00:00 2001 From: ludelanier Date: Tue, 14 May 2024 14:58:58 +0200 Subject: [PATCH] fix images --- Dockerfile | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index de299a6..bf161ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,18 @@ -# build stage -FROM node:lts-hydrogen AS build-stage -WORKDIR /app -COPY package*.json ./ -RUN npm install +# first stage builds vue +FROM node:16 as build-stage +WORKDIR /build COPY . . +RUN npm install RUN npm run build -FROM nginx:stable-alpine AS production-stage -COPY nginx.conf /etc/nginx/conf.d/default.conf -COPY --from=build-stage /app/dist /usr/share/nginx/html -CMD ["nginx", "-g", "daemon off;"] +# second stage copies the static dist files and Node server files +FROM node:16 as production-stage +WORKDIR /app +COPY package.json vueBaseAppServer.js ./ +COPY --from=build-stage /build/dist/ dist/ +RUN npm install --omit=dev +RUN rm -rf build + +# open port 3000 and run Node server +EXPOSE 3000 +CMD [ "node", "vueBaseAppServer.js" ] \ No newline at end of file