Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

fix(docker): strip the engine's core-piece devDependencies before the prune install (#15882)

Louai Boumediene28d64a49646b
diff --git a/Dockerfile b/Dockerfile
index 3a2934e2ef8..5a631cfd751 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -113,7 +113,8 @@ RUN node -e "\
# Remove workspaces not needed at runtime: pieces except the 5 the api imports,
# plus web/cli/tests-e2e/embed-sdk whose deps (react & friends) would otherwise land
# in the runtime node_modules. dist/packages/web is already built and kept.
-# Then drop the removed entries from the root workspaces list and regenerate bun.lock.
+# Then drop the removed entries from the root workspaces list, drop the engine's test-only
+# core-piece devDependencies (their workspaces are gone), and regenerate bun.lock.
RUN rm -rf packages/pieces/core packages/pieces/custom \
packages/web packages/cli packages/tests-e2e packages/ee && \
find packages/pieces/community -mindepth 1 -maxdepth 1 -type d \
@@ -124,6 +125,7 @@ RUN rm -rf packages/pieces/core packages/pieces/custom \
! -name microsoft-teams-bot \
-exec rm -rf {} + && \
node -e "const fs=require('fs');const p=JSON.parse(fs.readFileSync('package.json','utf8'));p.workspaces=p.workspaces.filter(w=>fs.existsSync(w.replace('/*','')));fs.writeFileSync('package.json',JSON.stringify(p,null,2))" && \
+ node -e "const fs=require('fs');const f='packages/server/engine/package.json';const p=JSON.parse(fs.readFileSync(f,'utf8'));p.devDependencies=Object.fromEntries(Object.entries(p.devDependencies).filter(([n])=>!n.startsWith('@activepieces/piece-')));fs.writeFileSync(f,JSON.stringify(p,null,2))" && \
rm -f bun.lock && bun install
### STAGE 2: Run ###
diff --git a/brain/knowledge/engineering/cloud-deployment-paths.md b/brain/knowledge/engineering/cloud-deployment-paths.md
index ff55189bd2c..8b6864eec70 100644
--- a/brain/knowledge/engineering/cloud-deployment-paths.md
+++ b/brain/knowledge/engineering/cloud-deployment-paths.md
@@ -23,3 +23,4 @@ Cloud's `workflow_call`/scheduled run skips `build-image`, so `deploy-canary` ge
- **Never put a BuildKit cache mount on `/var/cache/apt` or `/var/lib/apt`.** The `node:*-bullseye-slim` base ships `/etc/apt/apt.conf.d/docker-clean`, which wipes downloaded `.deb`s and sets `Keep-Downloaded-Packages "false"` — so the mount caches nothing, but it does persist stale `apt` lists and `partial/` leftovers across Depot builds. When `bullseye-security` republishes and old `.deb`s rotate out, the next build dies on `Hash Sum mismatch` / `Unable to fetch some archives` → `exit code: 100`, which reads like a missing package but isn't. Removed from both Dockerfiles on 2026-08-12; a plain `apt-get update && apt-get install` is what works. Also: bullseye `main` has been frozen since Aug 2025 and Debian 11 LTS ends Aug 2026, so the base image needs a bookworm bump.
- **Building the image locally from a branch can fail before your code is even copied.** Two independent causes seen 2026-09-10 on arm64: (1) `snapshot.debian.org` served corrupt `.deb`s (`Hash Sum mismatch`, `File has unexpected size … Mirror sync in progress?`, `Bad header line`) across three retries, with no cache mount involved — workaround is a throwaway Dockerfile whose base stage is `FROM ghcr.io/activepieces/activepieces:<root package.json version> AS base` (same bun/npm/isolated-vm tooling, no apt), plus `ENV NODE_ENV=development` and `RUN rm -rf /usr/src/app` at the top of the build stage (the published image sets `NODE_ENV=production`, which makes `bun install` skip devDependencies). (2) `bun install --frozen-lockfile` fails whenever any workspace `package.json` version differs from its `bun.lock` entry; check with `bun install --lockfile-only` in a copy and `diff` the result before blaming your change.
- **`breaking = true` on a migration and the `⛓️‍💥 breaking-change` PR label are different axes.** The migration flag is about rollback safety and is what stops deploys; the label is about self-hoster upgrade impact and is enforced by `breaking-change-check.yml` on PRs. Neither implies the other.
+- **The Dockerfile's prune step deletes `packages/pieces/core` (and every community piece but the api's 5), then re-runs `bun install` without a lockfile.** Any other kept workspace that declares one of the removed pieces as `workspace:*` breaks the image build with `Workspace dependency "@activepieces/piece-…" not found`. #15842 hit this by adding core pieces to the engine's devDependencies for CI tests; the prune step now strips the engine's `@activepieces/piece-*` devDependencies. Staging skips `build-image` for pushes inside its freeze window (17:00–09:00 UTC, `check-freeze`), so a broken build hides behind green overnight runs until the first daytime push. Check any new piece dependency outside `packages/pieces` against that step.