From 6a5579aa0eef931b8f865f1d03fe8f5174c7ceaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kol=C3=A1rik?= Date: Tue, 23 Jan 2024 20:23:06 +0100 Subject: [PATCH] fix: add git and optimize dockerfile --- Dockerfile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d3c82f5..813e5db2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,26 @@ -FROM node:18-bullseye-slim -RUN apt-get update -y && apt-get install tini util-linux curl -y +FROM node:18-bullseye-slim AS builder +RUN apt-get update -y && apt-get install util-linux curl git -y ENV NODE_ENV production -COPY . /app +ADD package.json package-lock.json /app/ WORKDIR /app RUN npm ci --include=dev +COPY . /app RUN npm run build +FROM node:18-bullseye-slim +RUN apt-get update -y && apt-get install tini util-linux curl -y + +ENV NODE_ENV production + +ADD package.json package-lock.json /app/ +WORKDIR /app +RUN npm ci +COPY . /app +COPY --from=builder /app/dist /app/dist +COPY --from=builder /app/data /app/data + ENV PORT=80 EXPOSE 80 ENTRYPOINT ["/usr/bin/tini", "--"]