This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Timmy-time-dashboard/docker/Dockerfile.test
Alexander Whitestone 6eefcabc97 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

67 lines
2.6 KiB
Docker

# ── Timmy Time — Test Runner Image ───────────────────────────────────────────
#
# Lean image with test dependencies baked in. Designed to be used with
# docker-compose.test.yml which bind-mounts src/, tests/, and static/
# so you never rebuild for code changes — only when deps change.
#
# Build: docker compose -f docker-compose.test.yml build
# Run: docker compose -f docker-compose.test.yml run --rm test
#
# The builder stage is shared with the production Dockerfile so
# dependency layers stay cached across dev ↔ test ↔ prod builds.
# ── Stage 1: Builder — export deps via Poetry, install via pip ──────────────
FROM python:3.12-slim AS builder
WORKDIR /build
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc curl \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir poetry poetry-plugin-export
# Copy only dependency files (layer caching — rebuilds only when deps change)
COPY pyproject.toml poetry.lock ./
# Export ALL deps including dev/test extras
RUN poetry export --extras swarm --extras telegram --extras discord --extras dev \
--with dev --without-hashes \
-f requirements.txt -o requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --no-cache-dir -r requirements.txt
# ── Stage 2: Test runtime ───────────────────────────────────────────────────
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
curl git fontconfig fonts-dejavu-core \
&& rm -rf /var/lib/apt/lists/*
# Copy installed packages from builder
COPY --from=builder /usr/local/lib/python3.12/site-packages \
/usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Create directories for bind mounts
RUN mkdir -p /app/src /app/tests /app/static /app/hands /app/data /app/docker
# Initialize a minimal git repo so git-dependent code (GitSafety, repo_root
# detection) works correctly inside the container.
RUN git config --global user.email "timmy@test" \
&& git config --global user.name "Timmy Test" \
&& git init /app \
&& git -C /app commit --allow-empty -m "init"
ENV PYTHONPATH=/app/src:/app/tests
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV TIMMY_TEST_MODE=1
# Default: run pytest (overridable via docker-compose command)
CMD ["pytest", "tests/", "-q", "--tb=short"]