From eda9a124432046b592415b586c13dfde7fc9e1be Mon Sep 17 00:00:00 2001 From: Anton Roslund Date: Sun, 10 Aug 2025 20:10:28 +0200 Subject: [PATCH] improve docker build time --- .dockerignore | 1 + Dockerfile | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index 6ed48a9..5b41fe6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ .env node_modules +.git \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index fe4921c..993acb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,16 @@ FROM node:lts-alpine -# add project files to /app -ADD ./ /app WORKDIR /app -# add open ssl +# Copy only package files and install deps +# This layer will be cached as long as package*.json don't change +COPY package*.json package-lock.json* ./ +RUN npm ci + +# Copy the rest of your source +COPY . . + RUN apk add --no-cache openssl -# install node dependencies -RUN npm install -EXPOSE 8080 +EXPOSE 8080 \ No newline at end of file