2026-02-28 11:07:19 -05:00
|
|
|
# ── Timmy Time Dashboard — Multi-stage Optimized Build ─────────────────────
|
|
|
|
|
#
|
|
|
|
|
# Multi-stage build for fast, lean image:
|
2026-02-28 13:12:14 -05:00
|
|
|
# 1. builder Export deps via Poetry + install with pip
|
2026-02-28 11:07:19 -05:00
|
|
|
# 2. runtime Copy only what's needed for production
|
|
|
|
|
#
|
|
|
|
|
# Build: docker build -f docker/Dockerfile.dashboard -t timmy-dashboard:latest .
|
|
|
|
|
# Run: docker run -p 8000:8000 -v timmy-data:/app/data timmy-dashboard:latest
|
|
|
|
|
|
|
|
|
|
# ── Stage 1: Builder ──────────────────────────────────────────────────────────
|
2026-02-28 13:12:14 -05:00
|
|
|
FROM python:3.12-slim AS builder
|
2026-02-28 11:07:19 -05:00
|
|
|
|
|
|
|
|
WORKDIR /build
|
|
|
|
|
|
|
|
|
|
# Install build dependencies
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
2026-02-28 13:12:14 -05:00
|
|
|
gcc curl git \
|
2026-02-28 11:07:19 -05:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2026-02-28 13:12:14 -05:00
|
|
|
# Install Poetry + export plugin for dependency export
|
|
|
|
|
RUN pip install --no-cache-dir poetry poetry-plugin-export
|
|
|
|
|
|
|
|
|
|
# Copy only dependency files for layer caching
|
|
|
|
|
COPY pyproject.toml poetry.lock ./
|
2026-02-28 11:07:19 -05:00
|
|
|
|
2026-02-28 13:12:14 -05:00
|
|
|
# Export pinned requirements and install with pip
|
feat: Phase 1 autonomy upgrades — introspection, heartbeat, source tagging, Discord auto-detect (#101)
UC-01: Live System Introspection Tool
- Add get_task_queue_status(), get_agent_roster(), get_live_system_status()
to timmy/tools_intro with graceful degradation
- Enhanced get_memory_status() with line counts, section headers, vault
directory listing, semantic memory row count, self-coding journal stats
- Register system_status MCP tool (creative/tools/system_status.py)
- Add system_status to Timmy's tool list + Hard Rule #7
UC-02: Fix Offline Status Bug
- Add registry.heartbeat() calls in task_processor run_loop() and
process_single_task() so health endpoint reflects actual agent status
- health.py now consults swarm registry instead of Ollama connectivity
UC-03: Message Source Tagging
- Add source field to Message dataclass (default "browser")
- Tag all message_log.append() calls: browser, api, system
- Include source in /api/chat/history response
UC-04: Discord Token Auto-Detection & Docker Fix
- Add _discord_token_watcher() background coroutine that polls every 30s
for DISCORD_TOKEN in env vars, .env file, or state file
- Add --extras discord to all three Dockerfiles (main, dashboard, test)
All 26 Phase 1 tests pass in Docker (make test-docker).
Full suite: 1889 passed, 77 skipped, 0 failed.
Co-authored-by: Alexander Payne <apayne@MM.local>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:49:24 -05:00
|
|
|
RUN poetry export --extras swarm --extras telegram --extras discord --without-hashes \
|
2026-02-28 13:12:14 -05:00
|
|
|
-f requirements.txt -o requirements.txt
|
2026-02-28 11:07:19 -05:00
|
|
|
|
2026-02-28 13:12:14 -05:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
|
|
|
pip install --no-cache-dir --user -r requirements.txt
|
2026-02-28 11:07:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# ── Stage 2: Runtime ─────────────────────────────────────────────────────────
|
2026-02-28 13:12:14 -05:00
|
|
|
FROM python:3.12-slim AS runtime
|
2026-02-28 11:07:19 -05:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install only runtime dependencies
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
curl \
|
|
|
|
|
fonts-dejavu-core \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
# Copy Python packages from builder
|
|
|
|
|
COPY --from=builder /root/.local /root/.local
|
|
|
|
|
|
|
|
|
|
# Copy application source
|
|
|
|
|
COPY src/ ./src/
|
|
|
|
|
COPY static/ ./static/
|
|
|
|
|
|
|
|
|
|
# Create data directory
|
|
|
|
|
RUN mkdir -p /app/data
|
|
|
|
|
|
|
|
|
|
# Create non-root user
|
|
|
|
|
RUN groupadd -r timmy && useradd -r -g timmy -d /app -s /sbin/nologin timmy && \
|
|
|
|
|
chown -R timmy:timmy /app && \
|
|
|
|
|
chmod -R o+rX /app/static /app/data
|
|
|
|
|
|
|
|
|
|
# Set environment
|
|
|
|
|
ENV PATH=/root/.local/bin:$PATH
|
|
|
|
|
ENV PYTHONPATH=/app/src
|
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
|
|
|
|
|
# Switch to non-root user
|
|
|
|
|
USER timmy
|
|
|
|
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
|
|
# Health check
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
|
|
|
CMD curl -f http://localhost:8000/health || exit 1
|
|
|
|
|
|
|
|
|
|
# Run dashboard
|
|
|
|
|
CMD ["uvicorn", "dashboard.app:app", "--host", "0.0.0.0", "--port", "8000"]
|