Files
agent-news/runner/Dockerfile
matt2dev 7bfe0dfe0c Fix HOME volume mount, genericize topic, add progress statuses, extract lexicon
- Volume was mounted at ~/.claude only, but claude-code writes auth to
  ~/.claude.json too — that file lived on the ephemeral container layer and
  was lost on every recreate. Now the whole $HOME is on the named volume,
  and claude-config moved outside HOME (/app) so it isn't shadowed by it.
- Default /news topic was hardcoded to AI; now it's a configurable
  DEFAULT_TOPIC (plain "главные новости дня"), topic is fully free-form.
- Prompt now instructs Claude to send interim " ..." progress updates via
  send_to_telegram while researching, not just the final digest — a bare
  request like "call this tool" was already taking 3+ minutes end-to-end,
  so silence read as broken.
- All user-facing/prompt text moved into bot/lib/lexicon.dart.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-21 21:53:38 +03:00

46 lines
2.2 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# agent-news — бот + claude-code CLI + MCP-мост в одном контейнере (Decision: см. план).
# Контекст сборки = корень репозитория (нужны bot/ и mcp_server/).
# docker build -f runner/Dockerfile -t agent-news:dev .
# ── stage 1: компиляция agent-news-bot ──────────────────────────────────
FROM mirror.service.bearsdev.tech/library/dart:stable AS bot-build
WORKDIR /build
COPY bot/pubspec.* ./
RUN dart pub get
COPY bot/ ./
RUN dart pub get --offline \
&& dart compile exe bin/agent_news_bot.dart -o /build/agent-news-bot
# ── stage 2: компиляция agent-news-mcp ──────────────────────────────────
FROM mirror.service.bearsdev.tech/library/dart:stable AS mcp-build
WORKDIR /build
COPY mcp_server/pubspec.* ./
RUN dart pub get
COPY mcp_server/ ./
RUN dart pub get --offline \
&& dart compile exe bin/agent_news_mcp.dart -o /build/agent-news-mcp
# ── stage 3: runtime — node (для claude-code CLI) + оба dart-бинарника ──
FROM mirror.service.bearsdev.tech/library/node:22-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g @anthropic-ai/claude-code \
&& npm cache clean --force
COPY --from=bot-build /build/agent-news-bot /usr/local/bin/agent-news-bot
COPY --from=mcp-build /build/agent-news-mcp /usr/local/bin/agent-news-mcp
RUN chmod +x /usr/local/bin/agent-news-bot /usr/local/bin/agent-news-mcp
RUN useradd -m -u 10001 agent
# claude-config живёт ВНЕ /home/agent: логин claude-code пишет не только в
# ~/.claude/, но и в файл ~/.claude.json — весь $HOME монтируется как volume
# (см. docker-compose.yml), и если положить конфиг внутрь home, он потеряется
# под пустым volume при первом старте.
COPY --chown=agent:agent runner/claude-config /app/claude-config
USER agent
WORKDIR /home/agent
ENV MCP_CONFIG_PATH=/app/claude-config/mcp.json
CMD ["agent-news-bot"]