mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 18:01:09 +02:00
Two real-world fixes from wiring mana-auth to Glitchtip:
1. The compiled dist/ folder was excluded from Docker builds via
.dockerignore's '**/dist' rule, so any container that pnpm-installed
the package found node_modules/@mana/shared-error-tracking but no
loadable entry point ('Cannot find module' at startup). Match the
pattern shared-hono uses — point main + types + exports straight at
src/*.ts. Bun runs TS natively and the type-only consumers don't
care.
2. Glitchtip projects expose UUID-format public keys (`556fbd2e-a720-…`)
in their generated DSNs. @sentry/node v9 tightened its DSN regex to
alphanumeric-only, so it silently rejects the DSN with "Invalid
Sentry Dsn" and never sends events. Strip the dashes from the
user/key portion before handing it to Sentry — the Glitchtip ingest
endpoint accepts both forms over the wire, so no server change.
Plus the missing Dockerfile COPY lines for shared-error-tracking and
eslint-config (root package.json devDeps reference the latter, which
breaks pnpm-filter installs that don't include it in the build context).
Verified end-to-end: 4 issues now in Glitchtip from mana-auth
(2 manual probes + 1 captureException + 1 401 from a
real /api/v1/me/data request without auth).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 lines
1.8 KiB
Docker
47 lines
1.8 KiB
Docker
# Install stage: use node + pnpm to resolve workspace dependencies.
|
|
# Build context must be the monorepo root (see docker-compose.macmini.yml).
|
|
FROM node:22-alpine AS installer
|
|
|
|
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy workspace structure
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
COPY services/mana-auth/package.json ./services/mana-auth/
|
|
COPY packages/shared-hono ./packages/shared-hono
|
|
COPY packages/shared-ai ./packages/shared-ai
|
|
COPY packages/shared-logger ./packages/shared-logger
|
|
COPY packages/shared-types ./packages/shared-types
|
|
COPY packages/shared-error-tracking ./packages/shared-error-tracking
|
|
# Root package.json devDeps reference @mana/eslint-config; pnpm filter
|
|
# install still resolves the root, so the package needs to be present
|
|
# even though mana-auth itself doesn't import from it.
|
|
COPY packages/eslint-config ./packages/eslint-config
|
|
|
|
# Install only mana-auth and its workspace deps
|
|
RUN pnpm install --filter @mana/auth... --no-frozen-lockfile --ignore-scripts
|
|
|
|
# Runtime stage: bun
|
|
FROM oven/bun:1 AS production
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy installed deps from installer stage
|
|
COPY --from=installer /app/node_modules ./node_modules
|
|
COPY --from=installer /app/services/mana-auth/node_modules ./services/mana-auth/node_modules
|
|
COPY --from=installer /app/packages ./packages
|
|
|
|
# Copy source
|
|
COPY services/mana-auth/package.json ./services/mana-auth/
|
|
COPY services/mana-auth/src ./services/mana-auth/src
|
|
COPY services/mana-auth/tsconfig.json services/mana-auth/drizzle.config.ts ./services/mana-auth/
|
|
|
|
WORKDIR /app/services/mana-auth
|
|
|
|
EXPOSE 3001
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
|
|
CMD bun -e "fetch('http://localhost:3001/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"
|
|
|
|
CMD ["bun", "run", "src/index.ts"]
|