fix(api): copy full node_modules instead of pnpm deploy to preserve prisma client

This commit is contained in:
Lizandro Guarnizo
2026-06-23 00:02:03 -05:00
parent 17302ee746
commit b875fe2af4
+1 -7
View File
@@ -1,4 +1,3 @@
# Coolify / producción — API NestJS
FROM node:22-alpine AS base
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
WORKDIR /app
@@ -8,17 +7,12 @@ COPY . .
RUN pnpm install --frozen-lockfile 2>/dev/null || pnpm install --no-frozen-lockfile --force
RUN pnpm --filter @moraworld/database exec prisma generate && pnpm --filter @moraworld/database build
RUN pnpm --filter @moraworld/api build
# pnpm deploy resuelve node_modules sin symlinks del store virtual
RUN pnpm --filter @moraworld/api deploy --prod /app/deploy
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup -S app && adduser -S app app
# node_modules de pnpm deploy (sin symlinks rotos) + dist del build explícito
COPY --from=builder /app/deploy/node_modules ./node_modules
# prisma generate crea archivos en node_modules/.prisma y @prisma/client que se pierden con pnpm deploy
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/apps/api/dist ./dist
COPY --from=builder /app/apps/api/package.json ./
COPY --from=builder /app/packages/database ./packages/database