Optimize Docker build cache for dependencies

This commit is contained in:
beatz174-bit
2025-11-23 10:42:59 +10:00
parent a7cd402c34
commit fe7e01d5fa
+3 -1
View File
@@ -2,12 +2,14 @@
# Build stage # Build stage
FROM node:20-alpine AS build FROM node:20-alpine AS build
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json* tsconfig*.json vite.config.ts ./ COPY package.json package-lock.json* ./
RUN --mount=type=cache,target=/root/.npm \ RUN --mount=type=cache,target=/root/.npm \
--mount=type=cache,target=/app/node_modules \ --mount=type=cache,target=/app/node_modules \
npm ci --no-audit --no-fund npm ci --no-audit --no-fund
COPY index.html ./ COPY index.html ./
COPY tsconfig*.json ./
COPY vite.config.ts ./
COPY src ./src COPY src ./src
COPY public ./public COPY public ./public
RUN --mount=type=cache,target=/app/node_modules npm run build RUN --mount=type=cache,target=/app/node_modules npm run build