From 12910b23ed3e5ac7208d3adfc90bc8b17409cca3 Mon Sep 17 00:00:00 2001 From: LouisLam Date: Mon, 9 Aug 2021 19:23:18 +0800 Subject: [PATCH] cache more layers for docker build --- dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dockerfile b/dockerfile index 489ae9409..7f82186dd 100644 --- a/dockerfile +++ b/dockerfile @@ -16,12 +16,13 @@ RUN apk add --no-cache python3 py3-cryptography py3-pip py3-six py3-yaml py3-cli RUN pip3 --no-cache-dir install apprise && \ rm -rf /root/.cache -# New things add here +# Install packages and cache the layer +COPY ./package.json ./package.json +RUN npm install --only=prod && rm -f ./package-lock.json +# Install dev packages, delete it after build COPY . . -RUN npm install && \ - npm run build && \ - npm prune +RUN npm install --only=dev && npm run build && npm prune EXPOSE 3001 VOLUME ["/app/data"]