feat: upgrade to qwen3.5, self-hosted Gitea CI, optimize Docker image
Model upgrade: - qwen2.5:14b → qwen3.5:latest across config, tools, and docs - Added qwen3.5 to multimodal model registry Self-hosted Gitea CI: - .gitea/workflows/tests.yml: lint + test jobs via act_runner - Unified Dockerfile: pre-baked deps from poetry.lock for fast CI - sitepackages=true in tox for ~2s dep resolution (was ~40s) - OLLAMA_URL set to dead port in CI to prevent real LLM calls Test isolation fixes: - Smoke test fixture mocks create_timmy (was hitting real Ollama) - WebSocket sends initial_state before joining broadcast pool (race fix) - Tests use settings.ollama_model/url instead of hardcoded values - skip_ci marker for Ollama-dependent tests, excluded in CI tox envs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
83
Dockerfile
83
Dockerfile
@@ -1,73 +1,34 @@
|
||||
# ── Timmy Time — agent image ────────────────────────────────────────────────
|
||||
# Timmy Time — unified image (CI · dev · production)
|
||||
#
|
||||
# Serves two purposes:
|
||||
# 1. `make docker-up` → runs the FastAPI dashboard (default CMD)
|
||||
# 2. `make docker-agent` → runs a swarm agent worker (override CMD)
|
||||
# All deps pre-installed from poetry.lock; project mounted at runtime.
|
||||
#
|
||||
# Build: docker build -t timmy-time:latest .
|
||||
# Dash: docker run -p 8000:8000 -v $(pwd)/data:/app/data timmy-time:latest
|
||||
# Agent: docker run -e COORDINATOR_URL=http://dashboard:8000 \
|
||||
# -e AGENT_NAME=Worker-1 \
|
||||
# timmy-time:latest \
|
||||
# python -m swarm.agent_runner --agent-id w1 --name Worker-1
|
||||
# Build: docker build -t timmy-time .
|
||||
# CI: act_runner mounts checkout automatically
|
||||
# Dev: docker run -v .:/app -p 8000:8000 timmy-time tox -e dev
|
||||
# Run: docker run -v .:/app -p 8000:8000 timmy-time
|
||||
|
||||
# ── Stage 1: Builder — install deps via Poetry ──────────────────────────────
|
||||
FROM python:3.12-slim AS builder
|
||||
FROM python:3.11-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc curl \
|
||||
# ── System + build prereqs ────────────────────────────────────────────────────
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
gcc git bash curl fonts-dejavu-core nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Install Poetry (only needed to resolve deps, not in runtime)
|
||||
RUN pip install --no-cache-dir poetry
|
||||
|
||||
# Copy dependency files only (layer caching)
|
||||
COPY pyproject.toml poetry.lock ./
|
||||
|
||||
# Install deps directly from lock file (no virtualenv, no export plugin needed)
|
||||
RUN poetry config virtualenvs.create false && \
|
||||
poetry install --only main --extras telegram --extras discord --no-root --no-interaction
|
||||
|
||||
# ── Stage 2: Runtime ───────────────────────────────────────────────────────
|
||||
FROM python:3.12-slim AS base
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl fonts-dejavu-core \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
# ── Python tooling ────────────────────────────────────────────────────────────
|
||||
RUN pip install --no-cache-dir poetry tox
|
||||
|
||||
# ── Pre-install all project deps (source mounted at runtime) ──────────────────
|
||||
WORKDIR /app
|
||||
COPY pyproject.toml poetry.lock ./
|
||||
RUN poetry config virtualenvs.create false \
|
||||
&& poetry install --with dev --no-root --no-interaction \
|
||||
&& rm pyproject.toml poetry.lock
|
||||
|
||||
# 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
|
||||
|
||||
# ── Application source ───────────────────────────────────────────────────────
|
||||
COPY src/ ./src/
|
||||
COPY static/ ./static/
|
||||
|
||||
# Create data directory (mounted as a volume in production)
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
# ── Non-root user for production ─────────────────────────────────────────────
|
||||
RUN groupadd -r timmy && useradd -r -g timmy -d /app -s /sbin/nologin timmy \
|
||||
&& chown -R timmy:timmy /app
|
||||
# Ensure static/ and data/ are world-readable so bind-mounted files
|
||||
# from the macOS host remain accessible when running as the timmy user.
|
||||
RUN chmod -R o+rX /app/static /app/data
|
||||
USER timmy
|
||||
|
||||
# ── Environment ──────────────────────────────────────────────────────────────
|
||||
ENV PYTHONPATH=/app/src
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
# ── Environment ───────────────────────────────────────────────────────────────
|
||||
ENV PYTHONPATH=/app/src \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# ── Healthcheck ──────────────────────────────────────────────────────────────
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
||||
CMD curl -f http://localhost:8000/health || exit 1
|
||||
|
||||
# ── Default: run the dashboard ───────────────────────────────────────────────
|
||||
CMD ["uvicorn", "dashboard.app:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
Reference in New Issue
Block a user