mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 21:01:08 +02:00
perf(docker): prune devDeps and cleanup node_modules in all backend Dockerfiles
Add pnpm prune --prod and remove .ts/.map/test/docs files from node_modules in the builder stage for chat, todo, calendar, clock, and contacts backends. Same approach as mana-core-auth optimization. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
152fa5fe08
commit
70671e2b2b
5 changed files with 35 additions and 0 deletions
|
|
@ -59,6 +59,13 @@ RUN pnpm build
|
|||
WORKDIR /app/apps/calendar/apps/backend
|
||||
RUN pnpm build
|
||||
|
||||
# Remove devDependencies and unnecessary files from node_modules
|
||||
WORKDIR /app
|
||||
RUN pnpm prune --prod --no-optional 2>/dev/null || true \
|
||||
&& find node_modules -name '*.ts' -not -name '*.d.ts' -delete 2>/dev/null || true \
|
||||
&& find node_modules -name '*.map' -delete 2>/dev/null || true \
|
||||
&& find node_modules -type d \( -name 'test' -o -name 'tests' -o -name '__tests__' -o -name 'docs' \) -prune -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
# Production stage
|
||||
FROM node:20-alpine AS production
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,13 @@ RUN pnpm build
|
|||
WORKDIR /app/apps/chat/apps/backend
|
||||
RUN pnpm build
|
||||
|
||||
# Remove devDependencies and unnecessary files from node_modules
|
||||
WORKDIR /app
|
||||
RUN pnpm prune --prod --no-optional 2>/dev/null || true \
|
||||
&& find node_modules -name '*.ts' -not -name '*.d.ts' -delete 2>/dev/null || true \
|
||||
&& find node_modules -name '*.map' -delete 2>/dev/null || true \
|
||||
&& find node_modules -type d \( -name 'test' -o -name 'tests' -o -name '__tests__' -o -name 'docs' \) -prune -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
# Production stage
|
||||
FROM node:20-alpine AS production
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,13 @@ RUN pnpm build
|
|||
WORKDIR /app/apps/clock/apps/backend
|
||||
RUN pnpm build
|
||||
|
||||
# Remove devDependencies and unnecessary files from node_modules
|
||||
WORKDIR /app
|
||||
RUN pnpm prune --prod --no-optional 2>/dev/null || true \
|
||||
&& find node_modules -name '*.ts' -not -name '*.d.ts' -delete 2>/dev/null || true \
|
||||
&& find node_modules -name '*.map' -delete 2>/dev/null || true \
|
||||
&& find node_modules -type d \( -name 'test' -o -name 'tests' -o -name '__tests__' -o -name 'docs' \) -prune -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
# Production stage
|
||||
FROM node:20-alpine AS production
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,13 @@ RUN pnpm build
|
|||
WORKDIR /app/apps/contacts/apps/backend
|
||||
RUN pnpm build
|
||||
|
||||
# Remove devDependencies and unnecessary files from node_modules
|
||||
WORKDIR /app
|
||||
RUN pnpm prune --prod --no-optional 2>/dev/null || true \
|
||||
&& find node_modules -name '*.ts' -not -name '*.d.ts' -delete 2>/dev/null || true \
|
||||
&& find node_modules -name '*.map' -delete 2>/dev/null || true \
|
||||
&& find node_modules -type d \( -name 'test' -o -name 'tests' -o -name '__tests__' -o -name 'docs' \) -prune -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
# Production stage
|
||||
FROM node:20-alpine AS production
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,13 @@ RUN pnpm build
|
|||
WORKDIR /app/apps/todo/apps/backend
|
||||
RUN pnpm build
|
||||
|
||||
# Remove devDependencies and unnecessary files from node_modules
|
||||
WORKDIR /app
|
||||
RUN pnpm prune --prod --no-optional 2>/dev/null || true \
|
||||
&& find node_modules -name '*.ts' -not -name '*.d.ts' -delete 2>/dev/null || true \
|
||||
&& find node_modules -name '*.map' -delete 2>/dev/null || true \
|
||||
&& find node_modules -type d \( -name 'test' -o -name 'tests' -o -name '__tests__' -o -name 'docs' \) -prune -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
# Production stage
|
||||
FROM node:20-alpine AS production
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue