Optimize Dockerfile for dependency installation: Implement caching for pnpm store during installation to improve build performance and efficiency in both development and production stages.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m8s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m8s
This commit is contained in:
@@ -6,7 +6,8 @@ WORKDIR /app
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
# Stage 2: Builder
|
||||
FROM node:20-alpine AS builder
|
||||
@@ -50,7 +51,8 @@ COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
||||
ENV DATABASE_URL="file:/tmp/build.db"
|
||||
|
||||
# Installer seulement les dépendances de production puis générer Prisma Client
|
||||
RUN pnpm install --frozen-lockfile --prod && \
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
||||
pnpm install --frozen-lockfile --prod && \
|
||||
pnpm dlx prisma generate
|
||||
|
||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||
|
||||
Reference in New Issue
Block a user