Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

perf(docker): the image install skips the MCP manifest, and the deploy build exports no cache

Sidwebworksb828554a352d
diff --git a/.claude/rules/mcp-tools-reference.md b/.claude/rules/mcp-tools-reference.md
index 0c7cb10dcf..58bc420741 100644
--- a/.claude/rules/mcp-tools-reference.md
+++ b/.claude/rules/mcp-tools-reference.md
@@ -28,7 +28,9 @@ catalogSearch, toolMetadata }`.
> root task `//#generate:mcp`. `postinstall` runs that task, and the `typecheck`,
> `build` and `test` of the two packages that read the manifest — `erp` and `docs`
> (`apps/erp/turbo.json`, `docs/turbo.json`) — depend on it, so a fresh clone
-> regenerates it before anything imports it. The task is CACHED: its `inputs` in
+> regenerates it before anything imports it. `SKIP_GENERATE_MCP=1` leaves it out of
+> the `postinstall` for installs that never read the manifest (the root `Dockerfile`
+> sets it; the erp `build` task still generates it there). The task is CACHED: its `inputs` in
> `turbo.json` are every `.ts` file under `apps/erp/app/modules`, the app's
> `types` and `utils`, the generated DB types, the two `mcp-*` lib files,
> `scripts/lib`, and the `src` of each package a `*.models.ts` imports. With none
diff --git a/.claude/rules/sst-deployment-infrastructure.md b/.claude/rules/sst-deployment-infrastructure.md
index 6fb1595e61..869e307b90 100644
--- a/.claude/rules/sst-deployment-infrastructure.md
+++ b/.claude/rules/sst-deployment-infrastructure.md
@@ -56,7 +56,9 @@ Triggers on push to `main` touching `apps/erp/**`, `apps/mes/**`, `packages/**`
stale — there is now ONE Dockerfile: `deps`→`build` (`pnpm run build:${APP}`)→
`runner` on `node:22-slim`).
- Pushes `carbon/<app>:latest` **and** `carbon/<app>:${{ github.sha }}` to ECR,
- `platforms: linux/amd64`, GHA buildx cache.
+ `platforms: linux/amd64`. No layer cache: this workflow only runs when
+ `apps/` or `packages/` changed, which invalidates every layer after the base, so
+ exporting one cost about two minutes a job and was never read back.
## Deploy (job `deploy`, needs `build`)
- Sets `IMAGE_TAG: ${{ github.sha }}` (this is what `sst.config.ts` interpolates
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index afeebfa6e6..b37fa06b98 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -50,8 +50,6 @@ jobs:
tags: |
${{ steps.login-ecr.outputs.registry }}/carbon/${{ matrix.app }}:latest
${{ steps.login-ecr.outputs.registry }}/carbon/${{ matrix.app }}:${{ github.sha }}
- cache-from: type=gha
- cache-to: type=gha,mode=max
platforms: linux/amd64
deploy:
diff --git a/Dockerfile b/Dockerfile
index fba3900c2a..a70d972fb3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,8 +25,10 @@ COPY docs/content ./docs/content
# than node's default ~2 GB heap. Inherited by `build`.
ARG NODE_OPTIONS="--max-old-space-size=8024"
ENV NODE_OPTIONS=${NODE_OPTIONS}
+# The manifest is not generated here: `build` makes it through turbo for erp, and
+# nothing else in an image reads it.
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store,sharing=locked \
- pnpm install --frozen-lockfile
+ SKIP_GENERATE_MCP=1 pnpm install --frozen-lockfile
FROM deps AS build
ARG APP
diff --git a/package.json b/package.json
index dd82f9f39d..887310d4f2 100755
--- a/package.json
+++ b/package.json
@@ -73,7 +73,7 @@
"lingui:compile": "lingui compile --namespace es",
"lingui:extract": "lingui extract --clean",
"lint": "turbo run lint",
- "postinstall": "MCP=//#generate:mcp; [ -n \"$VERCEL\" ] && [ \"${INIT_CWD##*/}\" = mes ] && MCP=; turbo run @carbon/documents#build $MCP --output-logs=new-only",
+ "postinstall": "MCP=//#generate:mcp; [ -n \"$VERCEL\" ] && [ \"${INIT_CWD##*/}\" = mes ] && MCP=; [ -n \"$SKIP_GENERATE_MCP\" ] && MCP=; turbo run @carbon/documents#build $MCP --output-logs=new-only",
"prepare": "case \"$(git config core.hooksPath)\" in *.husky) git config --unset core.hooksPath; git config --worktree --unset core.hooksPath;; esac; simple-git-hooks; if [ -f .ai/scripts/install-skills.sh ]; then bash .ai/scripts/install-skills.sh; fi",
"test": "turbo run test",
"translate": "pnpm run lingui:extract && pnpm exec linguito translate --llm && pnpm lingui:clean",