From 6b0005bcc69729647520636ff672c5d7a113b958 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 30 Oct 2024 13:32:43 +0100 Subject: [PATCH] Different yarn cache between platforms --- packages/server/Dockerfile | 3 ++- packages/worker/Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index 29b0fcb1f3..9668804a80 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -41,7 +41,8 @@ RUN chmod +x ./scripts/removeWorkspaceDependencies.sh RUN ./scripts/removeWorkspaceDependencies.sh package.json # Install yarn packages with caching -RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production --check-files \ +ARG TARGETPLATFORM +RUN --mount=type=cache,target=/root/.yarn/${TARGETPLATFORM} YARN_CACHE_FOLDER=/root/.yarn/${TARGETPLATFORM} yarn install --production \ && yarn cache clean \ && apk del g++ make python3 jq \ && rm -rf /tmp/* /root/.node-gyp /usr/local/lib/node_modules/npm/node_modules/node-gyp diff --git a/packages/worker/Dockerfile b/packages/worker/Dockerfile index cdc43d93f3..8cb7ee645b 100644 --- a/packages/worker/Dockerfile +++ b/packages/worker/Dockerfile @@ -24,7 +24,8 @@ COPY packages/worker/dist/yarn.lock . RUN ../scripts/removeWorkspaceDependencies.sh package.json -RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production --check-files +ARG TARGETPLATFORM +RUN --mount=type=cache,target=/root/.yarn/${TARGETPLATFORM} YARN_CACHE_FOLDER=/root/.yarn/${TARGETPLATFORM} yarn install --production --check-files # Remove unneeded data from file system to reduce image size RUN apk del .gyp \ && yarn cache clean