perf(docker): Add BuildKit cache mounts for faster builds
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Added cache mounts for: - pnpm store: Caches downloaded packages between builds - TurboRepo: Caches build outputs between builds This significantly speeds up subsequent builds: - First build: Full download and compile - Subsequent builds: Only changed packages are re-downloaded/rebuilt Requires Docker BuildKit (default in Docker 23+). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Enable BuildKit features for cache mounts
|
||||
|
||||
# Base image for all stages
|
||||
FROM node:20-alpine AS base
|
||||
|
||||
@@ -22,8 +25,9 @@ COPY packages/ui/package.json ./packages/ui/
|
||||
COPY packages/config/package.json ./packages/config/
|
||||
COPY apps/api/package.json ./apps/api/
|
||||
|
||||
# Install dependencies
|
||||
RUN pnpm install --frozen-lockfile
|
||||
# Install dependencies with pnpm store cache
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
# ======================
|
||||
# Builder stage
|
||||
@@ -41,7 +45,9 @@ COPY apps/api ./apps/api
|
||||
|
||||
# Build the API app and its dependencies using TurboRepo
|
||||
# This ensures @mosaic/shared is built first, then prisma:generate, then the API
|
||||
RUN pnpm turbo build --filter=@mosaic/api
|
||||
# Cache TurboRepo build outputs for faster subsequent builds
|
||||
RUN --mount=type=cache,id=turbo-cache,target=/app/.turbo \
|
||||
pnpm turbo build --filter=@mosaic/api
|
||||
|
||||
# ======================
|
||||
# Production stage
|
||||
|
||||
Reference in New Issue
Block a user