mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 12:54:29 +00:00
## Summary - **The `--docker` flag was a no-op stub** — `renderDocker` called the same local `executeRenderJob` as `renderLocal`, no container was ever launched - Now `renderDocker` generates a Dockerfile, builds a versioned `hyperframes-renderer:<version>` image with Chrome/FFmpeg/fonts/chrome-headless-shell, and runs the render inside a container - Image is cached per CLI version — first render builds (~2 min), subsequent renders reuse it - Forces `linux/amd64` platform since chrome-headless-shell has no ARM Linux binary - Uses `execFileSync` (array form) throughout to prevent shell injection - Forwards `--quiet`, `--gpu`, and render config flags into the container - `Dockerfile.render` added as a reference for manual builds ## Test plan - [x] `hyperframes render --docker` builds image and produces valid MP4 - [x] Second run reuses cached image (no rebuild) - [x] `--quiet` suppresses container output while keeping stderr for errors - [x] Typecheck, lint, format all pass - [ ] Verify `--gpu` with `--docker` on a machine with GPU access 🤖 Generated with [Claude Code](https://claude.com/claude-code)
34 lines
1.4 KiB
Docker
34 lines
1.4 KiB
Docker
FROM node:22-bookworm-slim
|
|
|
|
ARG HYPERFRAMES_VERSION=latest
|
|
|
|
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
|
|
|
|
RUN npx --yes @puppeteer/browsers install chrome-headless-shell@stable \
|
|
--path /root/.cache/puppeteer
|
|
|
|
RUN npm install -g hyperframes@${HYPERFRAMES_VERSION}
|
|
|
|
# Wrapper script: resolves chrome-headless-shell path at build time,
|
|
# sets PRODUCER_HEADLESS_SHELL_PATH at runtime so the engine uses
|
|
# BeginFrame rendering instead of falling back to system Chromium.
|
|
RUN SHELL_PATH=$(find /root/.cache/puppeteer/chrome-headless-shell -name "chrome-headless-shell" -type f | head -1) \
|
|
&& printf '#!/bin/sh\nexport PRODUCER_HEADLESS_SHELL_PATH=%s\nexec hyperframes render "$@"\n' "$SHELL_PATH" > /usr/local/bin/hf-render \
|
|
&& chmod +x /usr/local/bin/hf-render
|
|
|
|
WORKDIR /project
|
|
|
|
ENTRYPOINT ["hf-render"]
|