Files
agent-news/runner/Dockerfile
matt2dev be09de2ad7 Initial agent-news: Dart Telegram bot + Claude Code runner + MCP bridge
/news spawns claude-code as a local subprocess (single pod, no cross-container
exec on K3s); Claude delivers the digest itself via the send_to_telegram MCP tool.

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

43 lines
1.9 KiB
Docker
Raw 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
COPY --chown=agent:agent runner/claude-config /home/agent/claude-config
USER agent
WORKDIR /home/agent
ENV MCP_CONFIG_PATH=/home/agent/claude-config/mcp.json
# ~/.claude (OAuth-логин claude-code) монтируется сюда через PVC — см. deploy/agent-news.
CMD ["agent-news-bot"]