# Image where the platform's external Claude Code and Codex accounts run, isolated from the host.
FROM node:24-bookworm-slim

ARG CLAUDE_CODE_VERSION=2.1.281
ARG CODEX_VERSION=0.156.1
ARG CODEX_ACP_VERSION=1.13.1

RUN apt-get update \
  && apt-get install -y --no-install-recommends git ripgrep ca-certificates procps \
  && rm -rf /var/lib/apt/lists/*

RUN npm install -g \
    @anthropic-ai/claude-code@${CLAUDE_CODE_VERSION} \
    @openai/codex@${CODEX_VERSION} \
    @agentclientprotocol/codex-acp@${CODEX_ACP_VERSION} \
  && npm cache clean --force

# Containers run with the host user's UID, which has no account of its own in the image.
RUN mkdir -p /home/agent && chmod 0777 /home/agent

ENV CODEX_PATH=/usr/local/bin/codex
COPY entrypoint.sh status.sh claude-code-adapter.cjs /opt/agentic/
RUN chmod 0755 /opt/agentic/entrypoint.sh /opt/agentic/status.sh
ENTRYPOINT ["/opt/agentic/entrypoint.sh"]
