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 89cfe1be0d fix: Docker-first test suite, UX improvements, and bug fixes (#100)
Dashboard UX:
- Restructure nav from 22 flat links to 6 core + MORE dropdown
- Add mobile nav section labels (Core, Intelligence, Agents, System, Commerce)
- Defer marked.js and dompurify.js loading, consolidate CDN to jsdelivr
- Optimize font weights (drop unused 300/500), bump style.css cache buster
- Remove duplicate HTMX load triggers from sidebar and health panels

Bug fixes:
- Fix Timmy showing OFFLINE by registering after swarm recovery sweep
- Fix ThinkingEngine await bug with asyncio.run_coroutine_threadsafe
- Fix chat auto-scroll by calling scrollChat() after history partial loads
- Add missing /voice/button page and /voice/command endpoint
- Fix Grok api_key="" treated as falsy falling through to env key
- Fix self_modify PROJECT_ROOT using settings.repo_root instead of __file__

Docker test infrastructure:
- Bind-mount hands/, docker/, Dockerfiles, and compose files into test container
- Add fontconfig + fonts-dejavu-core for creative/assembler TextClip tests
- Initialize minimal git repo in Dockerfile.test for GitSafety compatibility
- Fix introspection and path resolution tests for Docker /app context

All 1863 tests pass in Docker (0 failures, 77 skipped).

Co-authored-by: Alexander Payne <apayne@MM.local>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:14:37 -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 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"]