FROM node:22-bookworm ENV NODE_ENV=production \ PORT=7860 \ HOST=0.0.0.0 \ WORKSPACE_ROOT=/tmp/hyperframes-work \ HOME=/app \ PRODUCER_FORCE_SCREENSHOT=true \ PUPPETEER_CACHE_DIR=/app/.cache/puppeteer \ HYPERFRAMES_WHISPER_PATH=/opt/whisper.cpp/build/bin/whisper-cli WORKDIR /app # HyperFrames needs FFmpeg/FFprobe and Chromium runtime libraries. RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ ca-certificates \ git \ cmake \ build-essential \ curl \ fonts-liberation \ libasound2 \ libatk-bridge2.0-0 \ libatk1.0-0 \ libcups2 \ libdbus-1-3 \ libdrm2 \ libgbm1 \ libgtk-3-0 \ libnspr4 \ libnss3 \ libx11-xcb1 \ libxcomposite1 \ libxdamage1 \ libxfixes3 \ libxkbcommon0 \ libxrandr2 \ xdg-utils \ python3 \ python3-pip \ && rm -rf /var/lib/apt/lists/* COPY package.json package-lock.json* ./ RUN npm install --omit=dev # Pre-cache Chrome, TTS dependencies, and whisper.cpp for HyperFrames rendering/media. RUN mkdir -p /app/.cache/puppeteer /app/.cache/hyperframes/whisper/models \ && npx puppeteer browsers install chrome-headless-shell \ && npx hyperframes browser ensure \ && python3 -m pip install --break-system-packages --no-cache-dir kokoro-onnx soundfile \ && git clone --depth 1 https://github.com/ggml-org/whisper.cpp.git /opt/whisper.cpp \ && cmake -S /opt/whisper.cpp -B /opt/whisper.cpp/build -DGGML_NATIVE=OFF -DWHISPER_BUILD_TESTS=OFF -DWHISPER_BUILD_EXAMPLES=ON \ && cmake --build /opt/whisper.cpp/build --config Release -j2 \ && test -x /opt/whisper.cpp/build/bin/whisper-cli \ && curl -L --fail --retry 3 -o /app/.cache/hyperframes/whisper/models/ggml-tiny.en.bin https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en.bin COPY server.mjs ./server.mjs RUN mkdir -p /tmp/hyperframes-work /app/.cache/puppeteer && chmod -R 777 /tmp/hyperframes-work /app/.cache EXPOSE 7860 CMD ["npm", "start"]