CI: Enable BuildKit cache mounts for faster npm installs
All checks were successful
Build & Deploy / build (push) Successful in 1m40s
Build & Deploy / deploy (push) Successful in 6s
Build & Deploy / bump-version (push) Successful in 3s

- Add syntax directive for BuildKit cache-mount support
- Cache /root/.npm between builds (web + server npm install)
- Enable DOCKER_BUILDKIT=1 in CI build step
- Remove aggressive builder prune that killed layer cache after each build

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-03-11 11:50:34 +01:00
parent 38fb648e15
commit bf5b995d7c
2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,9 @@
# syntax=docker/dockerfile:1
FROM node:24-slim AS web-build
WORKDIR /app/web
COPY web/package*.json ./
RUN npm install --no-audit --no-fund
RUN --mount=type=cache,target=/root/.npm npm install --no-audit --no-fund
COPY web/ .
ARG VITE_BUILD_CHANNEL=stable
ARG VITE_APP_VERSION=dev
@ -13,7 +15,7 @@ FROM node:24-slim AS server-deps
WORKDIR /app/server
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
COPY server/package*.json ./
RUN npm install --no-audit --no-fund
RUN --mount=type=cache,target=/root/.npm npm install --no-audit --no-fund
FROM server-deps AS server-build
COPY server/ .