From 869bc15ec3be0f70dc865c0cc967b74a4341bd3f Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 25 Nov 2020 15:19:30 +0100 Subject: [PATCH] =?UTF-8?q?Dockerfile:=20fix=20build=20=F0=9F=90=9B,=20opt?= =?UTF-8?q?imize=20layer=20caching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 75b31c2..0e87c56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,31 @@ FROM node:alpine as builder WORKDIR /app +# install dependencies RUN apk add --update git bash - ADD package.json /app -RUN npm install --production +RUN npm install + +# build documentation +ADD . /app +RUN npm run build + +# --- FROM node:alpine WORKDIR /app +# install dependencies +ADD package.json /app +RUN npm install --production + +# add source code +ADD . /app +COPY --from=builder /app/docs ./docs + EXPOSE 3000 ENV HOSTNAME v5.db.transport.rest ENV PORT 3000 -COPY --from=builder /app/node_modules ./node_modules -ADD . /app - -RUN npm run build - CMD ["node", "index.js"]