mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
d1b07d4513
generate-registry.ts imports the catalog cross-join/flatten fold from ../harness/src/shared/catalog/catalog-flatten.ts, which does `import yaml from "js-yaml"`. The generator's build/test environments did not stage that file (or its module-resolution scope), so the fold could not resolve. - Dockerfiles (shell, shell-dashboard, shell-docs, shell-dojo): COPY the shared catalog source + harness/package.json (its `"type":"module"` is required so catalog-flatten resolves as ESM and its named exports bind) and provide a node_modules for js-yaml resolution. - generate-registry-pattern.test.ts (makeHarness): stage catalog-flatten.ts and harness/package.json at the exact relative path the generator resolves, and symlink the scripts node_modules onto the harness tree so the ESM `import yaml from "js-yaml"` resolves. - js-yaml + @types/js-yaml added to showcase/scripts (package.json and the npm package-lock.json), and the root pnpm-lock.yaml regenerated to add the matching importer entries for showcase/scripts (js-yaml >=4.1.1 via the root override, @types/js-yaml ^4.0.9) so `pnpm install --frozen-lockfile` stays in sync.
54 lines
2.0 KiB
Docker
54 lines
2.0 KiB
Docker
FROM node:20-slim AS builder
|
|
ARG COMMIT_SHA=unknown
|
|
ARG BRANCH=unknown
|
|
WORKDIR /app
|
|
|
|
# Copy only what shell-dojo + scripts need
|
|
COPY showcase/scripts/package.json ./scripts/package.json
|
|
COPY showcase/shell-dojo/package.json ./shell-dojo/package.json
|
|
|
|
# Install deps for both (standalone, no workspace)
|
|
RUN cd scripts && npm install --silent && cd ../shell-dojo && npm install --silent
|
|
|
|
# Copy source
|
|
COPY showcase/shared/ ./shared/
|
|
COPY showcase/integrations/ ./integrations/
|
|
COPY showcase/scripts/ ./scripts/
|
|
COPY showcase/shell-dojo/ ./shell-dojo/
|
|
|
|
# Bake commit info into Next.js build
|
|
ENV NEXT_PUBLIC_COMMIT_SHA=${COMMIT_SHA}
|
|
ENV NEXT_PUBLIC_BRANCH=${BRANCH}
|
|
|
|
# generate-registry.ts imports the catalog cross-join/flatten fold from
|
|
# ../harness/src/shared/catalog/catalog-flatten.js. That file is ESM (relies on
|
|
# the harness package.json's `"type": "module"`) and does `import yaml from
|
|
# "js-yaml"`, resolved by walking up from the harness tree. Stage the fold + the
|
|
# harness package.json for the ESM scope, then point harness/node_modules at the
|
|
# already-installed scripts node_modules so js-yaml (+ its argparse dep) resolve
|
|
# — no second install of the harness package.
|
|
COPY showcase/harness/src/shared/catalog/ ./harness/src/shared/catalog/
|
|
COPY showcase/harness/package.json ./harness/package.json
|
|
RUN ln -s ../scripts/node_modules harness/node_modules
|
|
|
|
# Generate registry + content, then build Next.js
|
|
RUN cd scripts && node node_modules/tsx/dist/cli.mjs generate-registry.ts \
|
|
&& node node_modules/tsx/dist/cli.mjs bundle-demo-content.ts \
|
|
&& cd ../shell-dojo && npx next build
|
|
|
|
FROM node:20-slim AS runner
|
|
WORKDIR /app
|
|
ARG COMMIT_SHA=unknown
|
|
ARG BRANCH=unknown
|
|
ENV NODE_ENV=production
|
|
ENV PORT=10000
|
|
ENV NEXT_PUBLIC_COMMIT_SHA=${COMMIT_SHA}
|
|
ENV NEXT_PUBLIC_BRANCH=${BRANCH}
|
|
|
|
COPY --from=builder /app/shell-dojo/.next ./.next
|
|
COPY --from=builder /app/shell-dojo/node_modules ./node_modules
|
|
COPY --from=builder /app/shell-dojo/package.json ./
|
|
|
|
EXPOSE 10000
|
|
CMD ["npx", "next", "start", "-p", "10000"]
|