perf: optimize docker build with pnpm cache mounts and less aggressive pruning
Some checks failed
Build & Deploy / 🔍 Prepare Environment (push) Successful in 7s
Build & Deploy / 🏗️ Build (push) Failing after 1m5s
Build & Deploy / 🧪 QA (push) Successful in 3m46s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / ⚡ PageSpeed (push) Has been skipped
Build & Deploy / 🔔 Notifications (push) Successful in 2s

This commit is contained in:
2026-02-08 13:06:55 +01:00
parent ecb4f4450c
commit c4cd716dae
2 changed files with 10 additions and 4 deletions

View File

@@ -44,7 +44,7 @@ jobs:
shell: bash shell: bash
run: | run: |
docker image prune -f || true docker image prune -f || true
docker builder prune -f --filter "until=24h" || true docker builder prune -f --filter "until=168h" || true
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@@ -20,12 +20,18 @@ ENV SENTRY_SUPPRESS_TURBOPACK_WARNING=1
# Enable pnpm # Enable pnpm
RUN corepack enable RUN corepack enable
# Copy workspace configuration # Set pnpm home and store directory for caching
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN mkdir -p /pnpm/store
# Copy workspace configuration and manifests for better caching
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json .npmrc ./ COPY pnpm-lock.yaml pnpm-workspace.yaml package.json .npmrc ./
COPY apps/web/package.json ./apps/web/package.json COPY apps/web/package.json ./apps/web/package.json
# Install dependencies (use cache mount if possible, but keep it simple as per standard) # Install dependencies with cache mount
RUN pnpm install --no-frozen-lockfile RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install --frozen-lockfile
# Copy source # Copy source
COPY . . COPY . .