Files
hyperframes/Dockerfile.render
T
Vance IngallsandClaude Opus 4.6 699e7efb0d feat(cli): implement Docker rendering for deterministic output
The --docker flag was accepted but never actually launched a container.
renderDocker called the same executeRenderJob as renderLocal.

Now renderDocker:
- Generates a Dockerfile that installs hyperframes@<current-version>
- Builds a linux/amd64 image (hyperframes-renderer:<version>) with
  Chrome, FFmpeg, fonts, and chrome-headless-shell
- Caches the image per version — subsequent renders skip the build
- Uses a shell wrapper entrypoint that sets PRODUCER_HEADLESS_SHELL_PATH
  so the engine uses BeginFrame rendering
- Mounts the project read-only and output directory read-write
- Streams container output to the terminal

Forces linux/amd64 platform because chrome-headless-shell doesn't
ship ARM Linux binaries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:55:51 -07:00

69 lines
2.0 KiB
Docker

# HyperFrames — Deterministic Render Image
#
# Provides Chrome, FFmpeg, and fonts for byte-identical renders.
# The CLI generates this Dockerfile dynamically (with the correct version)
# when you run `hyperframes render --docker`.
#
# Manual build:
# docker build -f Dockerfile.render -t hyperframes-renderer:dev \
# --build-arg HYPERFRAMES_VERSION=0.2.3-alpha.1 .
#
# Manual run:
# docker run --rm --security-opt seccomp=unconfined --shm-size=2g \
# -v /path/to/project:/project:ro \
# -v /path/to/output:/output \
# hyperframes-renderer:dev \
# /project --output /output/render.mp4 --fps 30 --quality standard
FROM node:22-bookworm-slim
ARG HYPERFRAMES_VERSION=latest
# ── System dependencies ─────────────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
unzip \
ffmpeg \
chromium \
libgbm1 \
libnss3 \
libatk-bridge2.0-0 \
libdrm2 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libcups2 \
libasound2 \
libpangocairo-1.0-0 \
libxshmfence1 \
libgtk-3-0 \
fonts-liberation \
fonts-noto-color-emoji \
fonts-noto-cjk \
fonts-noto-core \
fonts-noto-extra \
fonts-noto-ui-core \
fonts-freefont-ttf \
fonts-dejavu-core \
fontconfig \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
&& fc-cache -fv
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
ENV CONTAINER=true
# chrome-headless-shell for deterministic BeginFrame rendering
RUN npx --yes @puppeteer/browsers install chrome-headless-shell@stable \
--path /root/.cache/puppeteer \
&& echo "chrome-headless-shell installed"
# Install hyperframes CLI (bundles producer, engine, core)
RUN npm install -g hyperframes@${HYPERFRAMES_VERSION}
WORKDIR /project
ENTRYPOINT ["hyperframes", "render"]