mirror of
http://172.20.10.11:3000/gitadmin/INSIGHT-MVP.git
synced 2026-06-25 03:46:40 +02:00
Eigenstaendiger NestJS-Service unter packages/crm-service/ mit: - Prisma Schema (app_crm): Contact, Activity, Pipeline, PipelineStage, Deal - JWT RS256 Auth mit shared Public Key und Token-Revocation - Multi-Tenancy: TenantGuard + tenantId-Filter auf allen Queries - CRUD-Module: Contacts, Activities, Pipelines, Deals - Docker-Integration: docker-compose.crm.yml (Port 3100, Traefik-Route /api/v1/crm) - Health-Check, Swagger, GlobalExceptionFilter, Pagination Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
1.3 KiB
Docker
56 lines
1.3 KiB
Docker
# ============================================================
|
|
# INSIGHT CRM-Service - Multi-Stage Dockerfile
|
|
# ============================================================
|
|
|
|
# --- Base Stage ---
|
|
FROM node:20-alpine AS base
|
|
WORKDIR /app
|
|
RUN apk add --no-cache openssl
|
|
|
|
# --- Dependencies Stage ---
|
|
FROM base AS deps
|
|
COPY package.json package-lock.json* ./
|
|
RUN npm ci --ignore-scripts
|
|
# Prisma Generate braucht die Schema-Dateien
|
|
COPY prisma ./prisma
|
|
RUN npx prisma generate --schema=prisma/crm.schema.prisma
|
|
|
|
# --- Development Stage ---
|
|
FROM base AS development
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN npx prisma generate --schema=prisma/crm.schema.prisma
|
|
EXPOSE 3100
|
|
CMD ["npm", "run", "start:dev"]
|
|
|
|
# --- Build Stage ---
|
|
FROM base AS build
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# --- Production Stage ---
|
|
FROM base AS production
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
|
|
# Nur Produktions-Dependencies
|
|
COPY package.json package-lock.json* ./
|
|
RUN npm ci --omit=dev --ignore-scripts
|
|
|
|
# Prisma Client generieren
|
|
COPY prisma ./prisma
|
|
RUN npx prisma generate --schema=prisma/crm.schema.prisma
|
|
|
|
# Kompilierter Code
|
|
COPY --from=build /app/dist ./dist
|
|
|
|
# Non-root User
|
|
RUN addgroup -g 1001 -S nodejs && \
|
|
adduser -S nestjs -u 1001 -G nodejs
|
|
USER nestjs
|
|
|
|
EXPOSE 3100
|
|
CMD ["node", "dist/main"]
|