Migrate from Hatchling to Poetry for dependency management, fixing the Docker build failure caused by .dockerignore excluding README.md that Hatchling needed for metadata. Poetry export strategy bypasses this entirely. Creative extras removed from main build (separate service). Docker changes: - Multi-stage builds with poetry export → pip install - BuildKit cache mounts for faster rebuilds - All 3 Dockerfiles updated (root, dashboard, agent) Bug fixes from tester audit: - TaskStatus/TaskPriority case-insensitive enum parsing - scrollChat() upgraded to requestAnimationFrame, removed duplicate - Desktop/mobile nav items synced in base.html - HTMX pointed to direct htmx.min.js URL - Removed unused highlight.js and bootstrap.bundle.min.js - Registered missing escalation/external task handlers in app.py Co-authored-by: Alexander Payne <apayne@MM.local> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
66 lines
2.1 KiB
Docker
66 lines
2.1 KiB
Docker
# ── Timmy Agent — Multi-stage Optimized Build ────────────────────────────────
|
|
#
|
|
# Lightweight agent container for running Timmy or swarm workers.
|
|
#
|
|
# Build: docker build -f docker/Dockerfile.agent -t timmy-agent:latest .
|
|
# Run: docker run -e COORDINATOR_URL=http://dashboard:8000 timmy-agent:latest
|
|
|
|
# ── Stage 1: Builder ──────────────────────────────────────────────────────────
|
|
FROM python:3.12-slim AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
# Install build dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 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 ./
|
|
|
|
# Export pinned requirements and install with pip
|
|
RUN poetry export --extras swarm --without-hashes \
|
|
-f requirements.txt -o requirements.txt
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
pip install --no-cache-dir --user -r requirements.txt
|
|
|
|
|
|
# ── Stage 2: Runtime ─────────────────────────────────────────────────────────
|
|
FROM python:3.12-slim AS runtime
|
|
|
|
WORKDIR /app
|
|
|
|
# Install only runtime dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy Python packages from builder
|
|
COPY --from=builder /root/.local /root/.local
|
|
|
|
# Copy application source
|
|
COPY src/ ./src/
|
|
|
|
# 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
|
|
|
|
# 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
|
|
|
|
# Default: run Timmy agent (can be overridden)
|
|
CMD ["python", "-m", "timmy.docker_agent"]
|