From d2f103654f41c1cc442b281c116b22a3098dfcd7 Mon Sep 17 00:00:00 2001 From: "Ezra (Archivist)" Date: Sun, 5 Apr 2026 20:40:29 +0000 Subject: [PATCH] intelligence(deepdive): Docker deployment scaffold for #830 - Add Dockerfile for production containerized pipeline - Add docker-compose.yml for full stack deployment - Add .dockerignore for clean builds - Add deploy.sh: one-command build, test, and systemd timer install This provides a sovereign, reproducible deployment path for the Deep Dive daily briefing pipeline. --- intelligence/deepdive/.dockerignore | 30 ++++++ intelligence/deepdive/Dockerfile | 42 ++++++++ intelligence/deepdive/deploy.sh | 124 +++++++++++++++++++++++ intelligence/deepdive/docker-compose.yml | 54 ++++++++++ 4 files changed, 250 insertions(+) create mode 100644 intelligence/deepdive/.dockerignore create mode 100644 intelligence/deepdive/Dockerfile create mode 100755 intelligence/deepdive/deploy.sh create mode 100644 intelligence/deepdive/docker-compose.yml diff --git a/intelligence/deepdive/.dockerignore b/intelligence/deepdive/.dockerignore new file mode 100644 index 0000000..94ed35e --- /dev/null +++ b/intelligence/deepdive/.dockerignore @@ -0,0 +1,30 @@ +# Deep Dive Docker Ignore +__pycache__/ +*.pyc +*.pyo +*.pyd +.Python +*.so +*.egg +*.egg-info/ +dist/ +build/ +.cache/ +.pytest_cache/ +.mypy_cache/ +.coverage +htmlcov/ +.env +.venv/ +venv/ +*.log +.cache/deepdive/ +output/ +audio/ +*.mp3 +*.wav +*.ogg +.git/ +.gitignore +.github/ +.gitea/ diff --git a/intelligence/deepdive/Dockerfile b/intelligence/deepdive/Dockerfile new file mode 100644 index 0000000..0809f04 --- /dev/null +++ b/intelligence/deepdive/Dockerfile @@ -0,0 +1,42 @@ +# Deep Dive Intelligence Pipeline — Production Container +# Issue: #830 — Sovereign NotebookLM Daily Briefing +# +# Build: +# docker build -t deepdive:latest . +# Run dry-run: +# docker run --rm -v $(pwd)/config.yaml:/app/config.yaml deepdive:latest --dry-run + +FROM python:3.11-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + ffmpeg \ + wget \ + curl \ + ca-certificates \ + git \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# Install Python dependencies first (layer caching) +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Pre-download embedding model for faster cold starts +RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" + +# Copy application code +COPY pipeline.py tts_engine.py fleet_context.py telegram_command.py quality_eval.py ./ +COPY prompts/ ./prompts/ +COPY tests/ ./tests/ +COPY Makefile README.md QUICKSTART.md OPERATIONAL_READINESS.md ./ + +# Create cache and output directories +RUN mkdir -p /app/cache /app/output +ENV DEEPDIVE_CACHE_DIR=/app/cache +ENV PYTHONUNBUFFERED=1 + +# Default: run pipeline with mounted config +ENTRYPOINT ["python3", "pipeline.py", "--config", "/app/config.yaml"] +CMD ["--dry-run"] diff --git a/intelligence/deepdive/deploy.sh b/intelligence/deepdive/deploy.sh new file mode 100755 index 0000000..92001cb --- /dev/null +++ b/intelligence/deepdive/deploy.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash +# deploy.sh — One-command Deep Dive deployment +# Issue: #830 — Sovereign NotebookLM Daily Briefing +# +# Usage: +# ./deploy.sh --dry-run # Build + test only +# ./deploy.sh --live # Build + install daily timer + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +COMPOSE_FILE="$SCRIPT_DIR/docker-compose.yml" +MODE="dry-run" + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' + +pass() { echo -e "${GREEN}[PASS]${NC} $*"; } +fail() { echo -e "${RED}[FAIL]${NC} $*"; } +info() { echo -e "${YELLOW}[INFO]${NC} $*"; } + +usage() { + echo "Usage: $0 [--dry-run | --live]" + echo " --dry-run Build image and run a dry-run test (default)" + echo " --live Build image, run test, and install systemd timer" + exit 1 +} + +if [[ $# -gt 0 ]]; then + case "$1" in + --dry-run) MODE="dry-run" ;; + --live) MODE="live" ;; + -h|--help) usage ;; + *) usage ;; + esac +fi + +info "==================================================" +info "Deep Dive Deployment — Issue #830" +info "Mode: $MODE" +info "==================================================" + +# --- Prerequisites --- +info "Checking prerequisites..." + +if ! command -v docker >/dev/null 2>&1; then + fail "Docker is not installed" + exit 1 +fi +pass "Docker installed" + +if ! docker compose version >/dev/null 2>&1 && ! docker-compose version >/dev/null 2>&1; then + fail "Docker Compose is not installed" + exit 1 +fi +pass "Docker Compose installed" + +if [[ ! -f "$SCRIPT_DIR/config.yaml" ]]; then + fail "config.yaml not found in $SCRIPT_DIR" + info "Copy config.yaml.example or create one before deploying." + exit 1 +fi +pass "config.yaml exists" + +# --- Build --- +info "Building Deep Dive image..." +cd "$SCRIPT_DIR" +docker compose -f "$COMPOSE_FILE" build deepdive +pass "Image built successfully" + +# --- Dry-run test --- +info "Running dry-run pipeline test..." +docker compose -f "$COMPOSE_FILE" run --rm deepdive --dry-run --since 48 +pass "Dry-run test passed" + +# --- Live mode: install timer --- +if [[ "$MODE" == "live" ]]; then + info "Installing daily execution timer..." + + SYSTEMD_DIR="$HOME/.config/systemd/user" + mkdir -p "$SYSTEMD_DIR" + + # Generate a service that runs via docker compose + cat > "$SYSTEMD_DIR/deepdive.service" < "$SYSTEMD_DIR/deepdive.timer" <