mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-01 19:42:03 +00:00
Two adopter-facing artifacts that close out Phase 6b's user-facing
surface:
- docs/deploy/migrating-to-hyperframes-lambda.mdx — side-by-side
concept mapping for users coming from another one-command-deploy
video renderer. Covers the verb mapping (deploy/render/progress/
destroy/sites/policies), composition format (plain HTML vs JSX),
render config, and a handful of intentional differences (no HDR
in distributed mode, no webm, gpu-mode=software requirement,
fail-closed font fetch, local stack-state files, narrow-after-
first-deploy IAM pattern). Closes with a migration checklist.
Per repo convention, no competitor framework is named anywhere
in the source — adopters self-identify.
- examples/k8s-jobs/Dockerfile.example + README.md — reference
Dockerfile for adopters who want to run distributed renders
outside AWS Lambda. Bakes Node 22 + chrome-headless-shell +
ffmpeg + the producer source. Deliberately not published to
a registry; adopters build it themselves so Chrome / ffmpeg /
producer versions stay pinned to the checkout they audited.
The README documents the typical K8s Jobs orchestration shape
that points adopters at packages/aws-lambda/src/handler.ts as
the reference adapter.
Migration guide registered under the existing Deploy group in
docs.json. .gitignore extended to negate the new examples/k8s-jobs/
path the same way examples/aws-lambda/ is negated.
No source code changes.
124 lines
5.7 KiB
Docker
124 lines
5.7 KiB
Docker
# HyperFrames distributed renderer — reference Dockerfile for non-Lambda runtimes.
|
|
#
|
|
# This image bakes Node 22, chrome-headless-shell, ffmpeg-static, and the
|
|
# `@hyperframes/producer/distributed` primitives. One image runs the
|
|
# Plan / RenderChunk / Assemble activities for any non-Lambda orchestrator:
|
|
#
|
|
# - Kubernetes Jobs (one Job per chunk, Argo Workflows on top)
|
|
# - AWS ECS Fargate (one task per chunk)
|
|
# - Google Cloud Run Jobs
|
|
# - Azure Container Apps Jobs
|
|
# - Plain `docker run` on a beefy VM
|
|
#
|
|
# We deliberately do NOT publish this image to a registry. The OSS contract
|
|
# is that adopters build it themselves — that way the Chrome / ffmpeg /
|
|
# producer versions are pinned to the source checkout they audited, not a
|
|
# floating tag we'd have to keep in sync with every release.
|
|
#
|
|
# Build from the repo root:
|
|
#
|
|
# docker build -t hyperframes-chunk-runner:local -f examples/k8s-jobs/Dockerfile.example .
|
|
#
|
|
# 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 \
|
|
# hyperframes-chunk-runner:local \
|
|
# node -e 'import("@hyperframes/producer/distributed").then(({renderChunk})=>renderChunk(...))'
|
|
#
|
|
# Lambda adopters use `packages/aws-lambda/dist/handler.zip` instead;
|
|
# this Dockerfile is the K8s / Cloud Run / ECS path.
|
|
|
|
# ── Base ─────────────────────────────────────────────────────────────────────
|
|
# Debian bookworm-slim because the chrome-headless-shell dynamic-library set
|
|
# matches what we use in CI. Amazon Linux 2023 also works (Lambda's base
|
|
# image) but is harder to debug locally.
|
|
FROM node:22-bookworm-slim AS base
|
|
|
|
# ── System deps ──────────────────────────────────────────────────────────────
|
|
# - ffmpeg: the producer's encode + audio mix
|
|
# - libfontconfig / libfreetype / fonts-liberation: Chrome text shaping
|
|
# - chromium-style ABI deps (the minimum set chrome-headless-shell needs):
|
|
# libnss3, libatk-bridge2.0, libdrm2, libgbm1, libxshmfence1, libxkbcommon0,
|
|
# libxcomposite1, libxdamage1, libxfixes3, libxrandr2, libasound2,
|
|
# libpangocairo-1.0-0
|
|
# - tini: clean PID 1 for container teardown signals (Cloud Run / Fargate
|
|
# send SIGTERM at the 10-min grace boundary).
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ffmpeg \
|
|
ca-certificates \
|
|
fonts-liberation \
|
|
libasound2 \
|
|
libatk-bridge2.0-0 \
|
|
libatk1.0-0 \
|
|
libc6 \
|
|
libcairo2 \
|
|
libcups2 \
|
|
libdbus-1-3 \
|
|
libdrm2 \
|
|
libfontconfig1 \
|
|
libfreetype6 \
|
|
libgbm1 \
|
|
libglib2.0-0 \
|
|
libnspr4 \
|
|
libnss3 \
|
|
libpango-1.0-0 \
|
|
libpangocairo-1.0-0 \
|
|
libxcomposite1 \
|
|
libxdamage1 \
|
|
libxfixes3 \
|
|
libxkbcommon0 \
|
|
libxrandr2 \
|
|
libxshmfence1 \
|
|
tini \
|
|
tzdata \
|
|
wget \
|
|
xz-utils \
|
|
&& 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
|
|
ENV CHROME_DIR=/opt/chrome
|
|
|
|
RUN mkdir -p "$CHROME_DIR" && \
|
|
npm install --global @puppeteer/browsers@2.13.0 && \
|
|
npx @puppeteer/browsers install "chrome-headless-shell@${CHROME_HEADLESS_SHELL_VERSION}" \
|
|
--path "$CHROME_DIR" && \
|
|
npm uninstall --global @puppeteer/browsers && \
|
|
rm -rf /root/.npm
|
|
|
|
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.
|
|
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/producer/package.json packages/producer/
|
|
|
|
RUN npm install --global bun && \
|
|
bun install --frozen-lockfile && \
|
|
npm uninstall --global bun
|
|
|
|
# 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.
|
|
COPY packages/core ./packages/core
|
|
COPY packages/engine ./packages/engine
|
|
COPY packages/producer ./packages/producer
|
|
|
|
# ── Runtime ──────────────────────────────────────────────────────────────────
|
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
|
# Default CMD prints the producer version + Chrome path; orchestrators
|
|
# typically override CMD with their per-chunk activity invocation.
|
|
CMD ["node", "-e", "console.log(JSON.stringify({producerVersion: require('./packages/producer/package.json').version, chromePath: process.env.PRODUCER_HEADLESS_SHELL_PATH}))"]
|