From 8ac66472915954f53439be6ea19008f872cf66df Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Fri, 4 Aug 2023 16:49:35 +0200 Subject: [PATCH] Make docker builds even faster --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index 27e107783..323ee196b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,9 +63,15 @@ RUN --mount=type=cache,target=/root/.cargo --mount=type=cache,target=/tmp/sccach COPY . ./ RUN env NODE_ENV=production sh -c "yarn workspace iceshrimp-js run build && yarn workspaces foreach --exclude native-utils --include sw --include client --include backend --include megalodon run build && yarn gulp" +# Prepare yarn cache (production) +RUN --mount=type=cache,target=/iceshrimp/.yarncache_prod cp -Tr .yarncache_prod .yarn + # Trim down the dependencies to only those for production RUN yarn workspaces focus --all --production +# Save yarn cache (production) +RUN --mount=type=cache,target=/iceshrimp/.yarncache_prod rm -rf .yarncache_prod/* && cp -Tr .yarn .yarncache_prod + ## Runtime container FROM alpine:3.18 WORKDIR /iceshrimp