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.

build(docker): add un-hardened ops image for migrate + seed Jobs (#1539)

Brad Barbinfd7fb3c397a2
diff --git a/Dockerfile b/Dockerfile
index 61ce9ef9bb..9645d2a183 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,6 +17,19 @@ ARG NODE_OPTIONS="--max-old-space-size=8024"
ENV NODE_OPTIONS=${NODE_OPTIONS}
RUN pnpm run build:${APP}
+# --- Ops image (DB migrations + first-boot seed) --------------------------
+# The migrate Job (supabase migration up) and the seed Helm hook (tsx src/seed.ts)
+# repurpose the app build to run one-off ops tasks. They need the supabase CLI
+# and tsx/esbuild — exactly the build tooling the `runner` stage strips for its
+# CVE posture. Rather than un-harden the served image, publish a separate
+# un-stripped ops image from the `deps` stage for those short-lived Jobs. It is
+# never exposed and is scanned report-only (it intentionally carries build-tool
+# CVEs). migrate.yml and charts/apps seed-job point at carbon/ops:<same-tag>.
+# Kept BEFORE `runner` so `runner` remains the default (no --target) build stage.
+FROM deps AS ops
+WORKDIR /repo/packages/database
+CMD ["bash"]
+
FROM node:22-slim AS runner
ARG APP
WORKDIR /repo