Skip to content

Commit 3eaa208

Browse files
committed
fix(registry): copy + build schemas workspace package in Dockerfile
#100 switched the registry's `@nimblebrain/mpak-schemas` dep from `^0.2.0` (published) to `workspace:*`, so pnpm now expects the package source on disk instead of pulling from npm. The Dockerfile only copied `apps/registry/`, never `packages/schemas/` — the registry build then errored with `Cannot find module '@nimblebrain/mpak-schemas' or its corresponding type declarations` across every file that imports the package. Builder stage: - COPY packages/schemas source files (package.json, tsconfig, tsup config, src/) before pnpm install so the workspace:* link resolves. - Run `pnpm --filter @nimblebrain/mpak-schemas build` (tsup) before the registry build so its dist/ exists for the registry's tsc to consume. Production stage: - The schemas package is a runtime dep too (Zod schemas like ServerDetailSchema are runtime values, not type-only imports). COPY the package.json and the prebuilt dist from the builder so the workspace:* link resolves at install time without rebuilding. No other workspace packages are runtime deps of the registry — only schemas.
1 parent 238a13e commit 3eaa208

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

apps/registry/Dockerfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,22 @@ WORKDIR /app
88
# Copy workspace config
99
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml tsconfig.base.json ./
1010

11+
# Copy the schemas workspace package — registry depends on it via
12+
# `workspace:*` so pnpm needs the source on disk to resolve the link.
13+
COPY packages/schemas/package.json packages/schemas/tsconfig.json packages/schemas/tsup.config.ts ./packages/schemas/
14+
COPY packages/schemas/src/ ./packages/schemas/src/
15+
1116
# Copy the registry app
1217
COPY apps/registry/package.json apps/registry/tsconfig.json apps/registry/prisma.config.ts ./apps/registry/
1318
COPY apps/registry/prisma/ ./apps/registry/prisma/
1419
COPY apps/registry/src/ ./apps/registry/src/
1520

16-
# Install dependencies
21+
# Install dependencies (resolves the workspace:* link to packages/schemas)
1722
RUN pnpm install --frozen-lockfile
1823

24+
# Build the schemas package first — registry imports its compiled dist.
25+
RUN pnpm --filter @nimblebrain/mpak-schemas build
26+
1927
# Generate Prisma client
2028
RUN cd apps/registry && npx prisma generate
2129

@@ -32,10 +40,16 @@ WORKDIR /app
3240
# Copy workspace config
3341
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
3442

43+
# Copy the schemas workspace package (runtime dep — registry imports
44+
# Zod schemas like `ServerDetailSchema` at runtime, not just types).
45+
COPY packages/schemas/package.json ./packages/schemas/
46+
COPY --from=builder /app/packages/schemas/dist/ ./packages/schemas/dist/
47+
3548
# Copy the registry app package.json
3649
COPY apps/registry/package.json ./apps/registry/
3750

38-
# Install production dependencies only
51+
# Install production dependencies only (workspace:* schemas resolves
52+
# to the dist we just copied above).
3953
RUN pnpm install --frozen-lockfile --prod
4054

4155
# Copy Prisma schema and generated client (Prisma 7 generates to hoisted node_modules)

0 commit comments

Comments
 (0)