fix: API Dockerfile — fresh pnpm install --prod in production stage
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 11s
CI / E2E Tests (push) Has been skipped
Deploy / Build API Image (push) Failing after 15s
Deploy / Build Web Image (push) Failing after 10s
Deploy / Build AI Services Image (push) Failing after 12s
E2E Tests / Playwright E2E (push) Failing after 23s
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 / Rollback Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 11s
CI / E2E Tests (push) Has been skipped
Deploy / Build API Image (push) Failing after 15s
Deploy / Build Web Image (push) Failing after 10s
Deploy / Build AI Services Image (push) Failing after 12s
E2E Tests / Playwright E2E (push) Failing after 23s
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 / Rollback Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
pnpm hoisted node_modules uses symlinks that break when copied between Docker stages. Install production deps fresh in final stage instead. Set WORKDIR to /app/apps/api so dist/main resolves correctly. Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,16 +47,21 @@ RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends dumb-init openssl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
WORKDIR /app/apps/api
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# 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
|
||||
# Install production dependencies fresh (pnpm hoisted node_modules has broken symlinks in Docker)
|
||||
COPY --from=deps /app/pnpm-lock.yaml /app/pnpm-workspace.yaml /app/package.json /app/turbo.json /app/
|
||||
COPY --from=deps /app/apps/api/package.json /app/apps/api/
|
||||
COPY --from=deps /app/prisma /app/prisma
|
||||
RUN corepack enable && corepack prepare pnpm@10.27.0 --activate \
|
||||
&& cd /app && pnpm install --frozen-lockfile --filter @goodgo/api... --prod \
|
||||
&& npx prisma generate
|
||||
# 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
|
||||
# Prisma schema
|
||||
COPY --from=build --chown=node:node /app/prisma /app/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