autojanet/container/Dockerfile
Zoë 2c1ea02386
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fix: copy opencode bin from builder instead of manual symlink
npm install -g creates the bin symlink in the builder stage;
copying it directly avoids the dangling symlink on chmod.
2026-05-30 15:48:07 -07:00

74 lines
2.2 KiB
Docker

# AutoJanet Agent Container
#
# Single image used for all 19 agent roles.
# Role is determined at runtime via AGENT_ROLE env var.
#
# Build:
# docker build -t registry.ctz.fyi/library/autojanet-agent:latest .
#
# The image bundles:
# - opencode CLI (Node.js)
# - Python entrypoint + dependencies
# - All 19 agent .md files
# - Common tools: git, curl, kubectl, helm
FROM node:22-bookworm-slim AS opencode-builder
# Install opencode globally
RUN npm install -g opencode-ai@latest
# ── Final image ───────────────────────────────────────────────────────────────
FROM debian:bookworm-slim
ARG KUBECTL_VERSION=v1.31.0
ARG HELM_VERSION=v3.16.0
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
python3 \
python3-pip \
python3-venv \
jq \
&& rm -rf /var/lib/apt/lists/*
# kubectl
RUN curl -fsSL "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
-o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl
# helm
RUN curl -fsSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" \
| tar -xz -C /usr/local/bin --strip-components=1 linux-amd64/helm
# Copy opencode from builder (node, modules, and the npm-generated bin symlink)
COPY --from=opencode-builder /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=opencode-builder /usr/local/bin/node /usr/local/bin/node
COPY --from=opencode-builder /usr/local/bin/opencode /usr/local/bin/opencode
# Create agent user
RUN useradd -m -u 1000 -s /bin/bash agent
WORKDIR /app
# Python deps
COPY container/requirements.txt /app/requirements.txt
RUN python3 -m venv /app/venv && \
/app/venv/bin/pip install --no-cache-dir -r /app/requirements.txt
# Agent entrypoint
COPY container/entrypoint.py /app/entrypoint.py
# All agent definition files
COPY agents/ /app/agents/
# Skills from ~/.config/opencode/skills — copied into repo at skills/
COPY skills/ /app/skills/
USER agent
ENV PATH="/app/venv/bin:$PATH"
ENV HOME="/home/agent"
ENTRYPOINT ["python3", "/app/entrypoint.py"]