FFmpeg in Docker for transcoding, thumbnail extraction, and metadata parsing. Videos stored in /data/uploads (mounted volume), served via streaming API route with Range headers and HLS segment caching. Upload flow: stream-write MP4 → ffprobe metadata → thumbnail → async HLS transcode → update revision status to ready. New files: - video-service.ts: FFmpeg/ffprobe wrapper (HLS, thumbnails, metadata) - /api/uploads/[...path]: streaming file server with Range support Modified: - upload-service.ts: video handling, 500MB limit, async HLS pipeline - upload route: accepts video/referenceVideo types - Dockerfile: ffmpeg + /data/uploads directory - docker-compose.yml: uploads_data volume Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
75 lines
2.2 KiB
YAML
75 lines
2.2 KiB
YAML
services:
|
|
# ─── PostgreSQL with pgvector ───────────────────────────
|
|
db:
|
|
image: pgvector/pgvector:pg17
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: hp_prod_tracker
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
- ./docker/db-init.sql:/docker-entrypoint-initdb.d/01-pgvector.sql:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# ─── Ollama (local AI — embeddings + chat fallback) ────
|
|
ollama:
|
|
image: ollama/ollama:latest
|
|
restart: unless-stopped
|
|
entrypoint: ["/bin/bash", "/entrypoint.sh"]
|
|
ports:
|
|
- "11434:11434"
|
|
volumes:
|
|
- ollama_data:/root/.ollama
|
|
- ./docker/ollama-entrypoint.sh:/entrypoint.sh:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -sf http://localhost:11434/api/tags || exit 1"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 12
|
|
start_period: 30s
|
|
# Uncomment for GPU acceleration (requires nvidia-container-toolkit):
|
|
# deploy:
|
|
# resources:
|
|
# reservations:
|
|
# devices:
|
|
# - driver: nvidia
|
|
# count: 1
|
|
# capabilities: [gpu]
|
|
|
|
# ─── Next.js app (production) ──────────────────────────
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
DATABASE_URL: postgresql://postgres:postgres@db:5432/hp_prod_tracker?schema=public
|
|
OLLAMA_HOST: http://ollama:11434
|
|
OLLAMA_EMBED_MODEL: nomic-embed-text
|
|
OLLAMA_LLM_MODEL: qwen3:1.7b
|
|
NODE_ENV: production
|
|
NEXTAUTH_URL: ${NEXTAUTH_URL:-http://localhost:3000}
|
|
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:-dev-secret-change-in-production}
|
|
volumes:
|
|
- uploads_data:/data/uploads
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
ollama:
|
|
condition: service_healthy
|
|
profiles:
|
|
- production
|
|
|
|
volumes:
|
|
pgdata:
|
|
ollama_data:
|
|
uploads_data:
|