mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +02:00
fix(mana-analytics): multi-stage Dockerfile that resolves workspace deps
Switches the build context to repo-root so the pnpm-workspace install can pull in @mana/shared-hono. Mirrors the mana-auth/mana-ai pattern (node+pnpm installer stage → bun runtime stage). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
722fe74ced
commit
db01ddccc7
2 changed files with 30 additions and 7 deletions
|
|
@ -569,8 +569,8 @@ services:
|
|||
|
||||
mana-analytics:
|
||||
build:
|
||||
context: services/mana-analytics
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
dockerfile: services/mana-analytics/Dockerfile
|
||||
image: mana-analytics:local
|
||||
container_name: mana-analytics
|
||||
restart: always
|
||||
|
|
|
|||
|
|
@ -1,16 +1,39 @@
|
|||
# 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-analytics/package.json ./services/mana-analytics/
|
||||
COPY packages/shared-hono ./packages/shared-hono
|
||||
|
||||
# Install only mana-analytics and its workspace deps
|
||||
RUN pnpm install --filter @mana/analytics... --no-frozen-lockfile --ignore-scripts
|
||||
|
||||
# Runtime stage: bun
|
||||
FROM oven/bun:1 AS production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json bun.lock* ./
|
||||
RUN bun install --frozen-lockfile 2>/dev/null || bun install
|
||||
# Copy installed deps from installer stage
|
||||
COPY --from=installer /app/node_modules ./node_modules
|
||||
COPY --from=installer /app/services/mana-analytics/node_modules ./services/mana-analytics/node_modules
|
||||
COPY --from=installer /app/packages ./packages
|
||||
|
||||
COPY src ./src
|
||||
COPY tsconfig.json drizzle.config.ts ./
|
||||
# Copy source
|
||||
COPY services/mana-analytics/package.json ./services/mana-analytics/
|
||||
COPY services/mana-analytics/src ./services/mana-analytics/src
|
||||
COPY services/mana-analytics/tsconfig.json services/mana-analytics/drizzle.config.ts ./services/mana-analytics/
|
||||
|
||||
WORKDIR /app/services/mana-analytics
|
||||
|
||||
EXPOSE 3064
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
|
||||
CMD bun -e "fetch('http://localhost:3064/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"
|
||||
|
||||
CMD ["bun", "run", "src/index.ts"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue