fix: API Dockerfile — copy full node_modules instead of pnpm deploy
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 7s
CI / E2E Tests (push) Has been skipped
Deploy / Build API Image (push) Failing after 15s
Deploy / Build Web Image (push) Failing after 14s
Deploy / Build AI Services Image (push) Failing after 14s
E2E Tests / Playwright E2E (push) Failing after 22s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 7s
CI / E2E Tests (push) Has been skipped
Deploy / Build API Image (push) Failing after 15s
Deploy / Build Web Image (push) Failing after 14s
Deploy / Build AI Services Image (push) Failing after 14s
E2E Tests / Playwright E2E (push) Failing after 22s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
pnpm deploy --legacy --prod doesn't resolve all transitive deps correctly in monorepo. Copy full node_modules from build stage instead. Also add openssl to production image (required by Prisma at runtime). Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -34,10 +34,6 @@ RUN npx prisma generate \
|
||||
&& (pnpm --filter @goodgo/mcp-servers build 2>/dev/null || true) \
|
||||
&& cd apps/api && npx nest build
|
||||
|
||||
# Use pnpm deploy to produce a flat, production-only node_modules
|
||||
# Copy generated Prisma client from build stage (pnpm deploy doesn't carry it)
|
||||
RUN pnpm deploy --legacy --filter @goodgo/api --prod /app/pruned
|
||||
|
||||
# ---- Production ----
|
||||
FROM node:22-slim AS production
|
||||
|
||||
@@ -48,22 +44,19 @@ LABEL org.opencontainers.image.title="goodgo-api" \
|
||||
|
||||
# dumb-init for proper PID 1 signal handling
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends dumb-init \
|
||||
&& apt-get install -y --no-install-recommends dumb-init openssl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Copy pruned production node_modules
|
||||
COPY --from=build --chown=node:node /app/pruned/node_modules ./node_modules
|
||||
# Copy full node_modules from build stage (pnpm deploy --prod is unreliable in monorepo)
|
||||
COPY --from=build --chown=node:node /app/node_modules ./node_modules
|
||||
# Copy compiled application
|
||||
COPY --from=build --chown=node:node /app/apps/api/dist ./dist
|
||||
# Prisma schema + migrations (needed for runtime client & migrate deploy)
|
||||
COPY --from=build --chown=node:node /app/prisma ./prisma
|
||||
# Copy generated Prisma client from build stage (not from pruned)
|
||||
COPY --from=build --chown=node:node /app/node_modules/.pnpm/@prisma+client@*/node_modules/@prisma/client ./node_modules/@prisma/client
|
||||
COPY --from=build --chown=node:node /app/node_modules/.pnpm/@prisma+client@*/node_modules/.prisma ./node_modules/.prisma
|
||||
# Package metadata
|
||||
COPY --from=build --chown=node:node /app/apps/api/package.json ./package.json
|
||||
# Entrypoint script
|
||||
|
||||
Reference in New Issue
Block a user