Skip to content

Write HTML. Render video. Built for agents.

fix(examples): the k8s chunk-runner image installs and loads the producer again (#5373)

Miguel Ángel6f3f86a9c982
diff --git a/examples/k8s-jobs/Dockerfile.example b/examples/k8s-jobs/Dockerfile.example
index 56d1510ab4..a6693b2f6c 100644
--- a/examples/k8s-jobs/Dockerfile.example
+++ b/examples/k8s-jobs/Dockerfile.example
@@ -1,6 +1,6 @@
# HyperFrames distributed renderer — reference Dockerfile for non-Lambda runtimes.
#
-# This image bakes Node 22, chrome-headless-shell, ffmpeg-static, and the
+# This image bakes Node 22, bun, chrome-headless-shell, ffmpeg, and the
# `@hyperframes/producer/distributed` primitives. One image runs the
# Plan / RenderChunk / Assemble activities for any non-Lambda orchestrator:
#
@@ -22,10 +22,10 @@
# Run a chunk worker (an orchestrator script wraps this entry point):
#
# docker run --rm \
-# -e PRODUCER_HEADLESS_SHELL_PATH=/opt/chrome/chrome-headless-shell \
# -v /tmp/hyperframes:/tmp/hyperframes \
+# -w /app/packages/aws-lambda \
# hyperframes-chunk-runner:local \
-# node -e 'import("@hyperframes/producer/distributed").then(({renderChunk})=>renderChunk(...))'
+# bun -e 'const { renderChunk } = await import("@hyperframes/producer/distributed"); await renderChunk(...)'
#
# Lambda adopters use `packages/aws-lambda/dist/handler.zip` instead;
# this Dockerfile is the K8s / Cloud Run / ECS path.
@@ -38,7 +38,8 @@ FROM node:22-bookworm-slim AS base
# ── System deps ──────────────────────────────────────────────────────────────
# - ffmpeg: the producer's encode + audio mix
-# - libfontconfig / libfreetype / fonts-liberation: Chrome text shaping
+# - libfontconfig / libfreetype / fonts-*: Chrome text shaping, the font set
+# packages/gcp-cloud-run/Dockerfile uses (CJK and emoji included)
# - chromium-style ABI deps (the minimum set chrome-headless-shell needs):
# libnss3, libatk-bridge2.0, libdrm2, libgbm1, libxshmfence1, libxkbcommon0,
# libxcomposite1, libxdamage1, libxfixes3, libxrandr2, libasound2,
@@ -48,7 +49,14 @@ FROM node:22-bookworm-slim AS base
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
ca-certificates \
+ fonts-dejavu-core \
+ fonts-freefont-ttf \
fonts-liberation \
+ fonts-noto-cjk \
+ fonts-noto-color-emoji \
+ fonts-noto-core \
+ fonts-noto-extra \
+ fonts-noto-ui-core \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
@@ -78,10 +86,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# ── Chrome ───────────────────────────────────────────────────────────────────
-# Use `@puppeteer/browsers` to fetch the same chrome-headless-shell version
-# the producer pins. Keep the bun + chrome install in the build context so
-# the runtime image is reproducible.
-ENV CHROME_HEADLESS_SHELL_VERSION=131.0.6778.139
+# Use `@puppeteer/browsers` to fetch the chrome-headless-shell version
+# packages/gcp-cloud-run/Dockerfile pins.
+ENV CHROME_HEADLESS_SHELL_VERSION=148.0.7778.167
ENV CHROME_DIR=/opt/chrome
RUN mkdir -p "$CHROME_DIR" && \
@@ -94,27 +101,32 @@ RUN mkdir -p "$CHROME_DIR" && \
ENV PRODUCER_HEADLESS_SHELL_PATH=${CHROME_DIR}/chrome-headless-shell/linux-${CHROME_HEADLESS_SHELL_VERSION}/chrome-headless-shell-linux64/chrome-headless-shell
# ── HyperFrames ──────────────────────────────────────────────────────────────
-# Copy the workspace bun-locked package set. We use bun in the build
-# (matches the rest of the repo) but the runtime is plain Node — no bun
-# is needed at run time.
+# Producer code runs under bun, as in packages/gcp-cloud-run/Dockerfile: its
+# workspace exports point at TypeScript source. Run it from a workspace that
+# depends on it (e.g. packages/aws-lambda); the root package does not.
WORKDIR /app
COPY package.json bun.lock ./
COPY packages/aws-lambda/package.json packages/aws-lambda/
COPY packages/core/package.json packages/core/
COPY packages/engine/package.json packages/engine/
+COPY packages/lint/package.json packages/lint/
+COPY packages/parsers/package.json packages/parsers/
+COPY packages/player/package.json packages/player/
COPY packages/producer/package.json packages/producer/
+COPY packages/studio-server/package.json packages/studio-server/
-RUN npm install --global bun && \
- bun install --frozen-lockfile && \
- npm uninstall --global bun
+RUN npm install --global [email protected] && \
+ bun install --frozen-lockfile
-# Bring in the source. We're not building the producer's dist/ here — bun's
-# workspace + tsx + esm resolution can run the producer straight from
-# `packages/producer/src/**`. Adopters who want a built distribution can
-# `bun run --cwd packages/producer build` against this image.
+# Bring in the source. Core's build generates files its source imports
+# (e.g. runtime-inline); the other packages run from source under bun.
COPY packages/core ./packages/core
COPY packages/engine ./packages/engine
+COPY packages/lint ./packages/lint
+COPY packages/parsers ./packages/parsers
COPY packages/producer ./packages/producer
+COPY packages/studio-server ./packages/studio-server
+RUN bun run --cwd packages/core build
# ── Runtime ──────────────────────────────────────────────────────────────────
ENTRYPOINT ["/usr/bin/tini", "--"]
diff --git a/examples/k8s-jobs/Dockerfile.example.dockerignore b/examples/k8s-jobs/Dockerfile.example.dockerignore
new file mode 100644
index 0000000000..bc707ed16c
--- /dev/null
+++ b/examples/k8s-jobs/Dockerfile.example.dockerignore
@@ -0,0 +1,4 @@
+# Keeps local installs, build output and the LFS test fixtures out of the image.
+**/node_modules
+**/dist
+packages/*/tests
diff --git a/examples/k8s-jobs/README.md b/examples/k8s-jobs/README.md
index a97c92f7ff..70891ab30f 100644
--- a/examples/k8s-jobs/README.md
+++ b/examples/k8s-jobs/README.md
@@ -1,6 +1,6 @@
# K8s / Cloud Run / ECS reference Dockerfile
-This directory ships a reference `Dockerfile.example` for adopters who want to run HyperFrames distributed renders **outside AWS Lambda**. The image bakes Node 22 + `chrome-headless-shell` + `ffmpeg` + the producer source, and works on Kubernetes Jobs, Argo Workflows, Cloud Run Jobs, ECS Fargate, or plain `docker run`.
+This directory ships a reference `Dockerfile.example` for adopters who want to run HyperFrames distributed renders **outside AWS Lambda**. The image bakes Node 22 + bun + `chrome-headless-shell` + `ffmpeg` + the producer source, and works on Kubernetes Jobs, Argo Workflows, Cloud Run Jobs, ECS Fargate, or plain `docker run`.
We do **not** publish this image to a registry — the OSS contract is that adopters build it themselves so Chrome / ffmpeg / producer versions stay pinned to the source checkout they audited, not a floating tag we'd have to keep in sync with every release.
@@ -12,11 +12,11 @@ From the repo root:
docker build -t hyperframes-chunk-runner:local -f examples/k8s-jobs/Dockerfile.example .
```
-The build pulls `chrome-headless-shell` via `@puppeteer/browsers` and installs Debian system packages for the Chromium ABI deps. Expect a ~1.2 GB compressed image; ~3 GB unpacked.
+The build pulls `chrome-headless-shell` via `@puppeteer/browsers` and installs Debian system packages for the Chromium ABI deps. Expect about 2.8 GB unpacked.
## Use
-The producer's distributed primitives are pure functions over local paths. Wire them into your orchestrator however you like:
+The producer's distributed primitives are pure functions over local paths. Wire them into your orchestrator however you like. In the image, run them with `bun` from `/app/packages/aws-lambda` (the Dockerfile header shows the `docker run` line):
```ts
import { plan, renderChunk, assemble } from "@hyperframes/producer/distributed";