Files
recap/Dockerfile
T
Keysat 373d10595b Pluggable AI providers, relay credit system, picker UX overhaul
Captures roughly forty version bumps (v0.2.6 → v0.2.47) of work that
accumulated without commits.

- Pluggable provider system under server/providers/: gemini, anthropic,
  openai, openai-compatible, ollama, whisper-compatible, relay. Mix and
  match transcription + analysis per request via the picker UI.
- Relay backend integration. Hardcoded relay URL in server/relay-default.js
  (operator-controlled at build time, not user-configurable). New
  /api/relay/{status,policy} endpoints proxy to the relay; balance pings
  populate a cached credit display.
- Per-install identity in server/install-id.js for relay credit accounting.
  Sent to the relay as X-Recap-Install-Id; persists across upgrades, lost
  on a full uninstall + reinstall. Not surfaced in the UI.
- Admin login gate (server/admin-auth.js + setAdminPassword action). Scrypt
  password hash + HMAC-signed session cookie.
- Entitlement scheme rename: pro / max (each paired with subscriptions and
  relay_pro / relay_max), replacing the misleading "core" entitlement
  that conflicted with the user-facing "Core" tier name.
- Activation screen: dynamic credit count pulled from /api/relay/policy,
  "Skip — use free mode" button, accurate paid-feature list.
- Top toolbar: inline credit-balance pill (or "BYO configured" fallback),
  Upgrade + "I have a key" buttons.
- Picker UI: per-provider sections with Save/Test/Delete buttons, sections
  collapsible by chevron, default-collapsed unless currently selected,
  "Use comped credits (reset to relay)" link when the user has strayed,
  green hint under inputs whose values are server-configured.
- Activity log: chevron-collapsible groups per video, refresh-survival via
  localStorage + a 500-entry server-side buffer, explicit Clear button.
- YouTube captions fast-path with user toggle (skips audio download + AI
  transcription when captions are available — uncheck for speaker labels).
- Cancel button: AbortController plumbed through every provider SDK call;
  retryAPI short-circuits on AbortError; cancellation events surface in
  the activity log instead of silent retries.
- Long-video analysis: auto-coalesce transcript entries before building the
  analysis prompt so local-model context windows (32k-ish) don't overflow.
  Original entries preserved for transcript display via an index map; the
  analyzer sees a coarser view but click-to-seek timestamps stay precise.
- StartOS action grouping (Setup / AI Providers) so the actions list is
  navigable.
- Manifest description rewritten to reflect multi-provider support and
  free-tier relay credits.
- Smaller fixes: summarize-button enablement no longer requires a Gemini
  key when other providers are configured; analysis fallback chain handles
  context-length and 503 capacity errors; single-segment expansion for
  providers that don't return per-segment timestamps (Parakeet et al.);
  many other UX polish items.
2026-05-11 23:46:20 -05:00

80 lines
3.2 KiB
Docker

# ─────────────────────────────────────────────────────────
# Recap — StartOS 0.4 Docker image
#
# Includes: Node.js 20, Python 3, yt-dlp, ffmpeg
#
# Uses Debian slim (not Alpine) because:
# - Debian is more reliable for pip-installed packages with C deps
# ─────────────────────────────────────────────────────────
# ── Stage 1: Install Node.js dependencies ──────────────────
FROM node:20-slim AS builder
# @keysat/licensing-client is a private git repo, so we vendor its built
# output into vendor/ and reference it via a file: dep. That removes any
# need for git or credentials in the build container.
#
# The vendor package needs its own node_modules (for @noble/ed25519 etc.)
# because npm's file: deps create a symlink, and Node's module resolver
# walking up from a symlinked location won't find the parent project's
# node_modules. Installing inside the vendor dir is the simplest fix.
WORKDIR /app
COPY vendor/keysat-licensing-client /app/vendor/keysat-licensing-client
WORKDIR /app/vendor/keysat-licensing-client
RUN npm install --omit=dev --ignore-scripts
WORKDIR /app/server
COPY server/package.json server/package-lock.json* ./
RUN npm ci --omit=dev --ignore-scripts 2>/dev/null || npm install --omit=dev --ignore-scripts
# ── Stage 2: Final runtime image ───────────────────────────
FROM node:20-slim AS runner
WORKDIR /app
# Install runtime dependencies:
# - dumb-init: proper PID 1 signal handling in containers
# - curl: health checks + yt-dlp binary downloads
# - python3 + pip: yt-dlp installation and updates
# - ffmpeg: audio extraction, splitting, and duration detection
# - ca-certificates: HTTPS for YouTube/Gemini API calls
RUN apt-get update && apt-get install -y --no-install-recommends \
dumb-init \
curl \
python3 \
python3-pip \
python3-venv \
ffmpeg \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --break-system-packages yt-dlp \
&& yt-dlp --version
# Copy Node.js app from builder
COPY --from=builder /app/vendor ./vendor/
COPY --from=builder /app/server/node_modules ./server/node_modules/
COPY server/package.json ./server/
# Top-level *.js files (index.js, license.js, util.js, gemini-helpers.js,
# audio.js, ytdlp.js, cookies.js, config.js, license-middleware.js,
# history.js, library.js, admin-auth.js, …) PLUS the providers/
# subdirectory (multi-provider AI adapters). Anything new added in
# `server/<subdir>/` needs its own COPY line — the glob does not recurse.
COPY server/*.js ./server/
COPY server/providers/ ./server/providers/
COPY public/ ./public/
COPY assets/ ./assets/
# Copy entrypoint scripts
COPY docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
RUN chmod +x /usr/local/bin/docker_entrypoint.sh
# Create persistent data mount point
RUN mkdir -p /data
ENV NODE_ENV=production \
PORT=3001 \
DATA_DIR=/data
EXPOSE 3001
ENTRYPOINT ["dumb-init", "--", "/usr/local/bin/docker_entrypoint.sh"]