fix(docker): lock build cache mounts

- Use explicit fresh BuildKit cache IDs for Yarn and Next build caches

- Serialize cache writes during multi-platform production builds

- Avoid corrupt Yarn tar extraction from concurrent cache writes
This commit is contained in:
Timothy Stewart
2026-07-19 13:36:20 -05:00
parent ade47ac6e6
commit 201da75eae
+2 -2
View File
@@ -3,7 +3,7 @@ FROM node:24.18.0-alpine@sha256:a0b9bf06e4e6193cf7a0f58816cc935ff8c2a908f81e6f1a
WORKDIR /usr/src/app
COPY package.json ./
COPY yarn.lock ./
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn/v6 \
RUN --mount=type=cache,id=littlelink-yarn-v1-cache-v2,target=/usr/local/share/.cache/yarn/v6,sharing=locked \
yarn install --frozen-lockfile --check-files --network-timeout 600000
FROM node:24.18.0-alpine@sha256:a0b9bf06e4e6193cf7a0f58816cc935ff8c2a908f81e6f1a95432d679c54fbfd AS node-build
@@ -20,7 +20,7 @@ COPY tsconfig.server.json ./
COPY next-env.d.ts ./
COPY server.ts ./
ENV NEXT_TELEMETRY_DISABLED=1
RUN --mount=type=cache,target=/usr/src/app/.next/cache yarn build
RUN --mount=type=cache,id=littlelink-next-cache-v2,target=/usr/src/app/.next/cache,sharing=locked yarn build
RUN rm -rf \
.next/standalone/node_modules/@img/sharp-libvips-linux-* \
.next/standalone/node_modules/@img/sharp-linux-*