# Leader - The Orchestrator FROM oven/bun:debian LABEL role="leader" LABEL description="The orchestrator of the agent ecosystem" # Essential tools RUN apt-get update && apt-get install -y --no-install-recommends \ bash \ less \ curl \ git \ jq \ tree \ make \ ca-certificates \ ripgrep \ && rm -rf /var/lib/apt/lists/* # Install yq RUN curl -sL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/local/bin/yq \ && chmod +x /usr/local/bin/yq # Install ast-grep (sg) via npm RUN bun install -g @ast-grep/cli && \ ln -sf $(which ast-grep) /usr/local/bin/sg # Set bun paths ENV BUN_INSTALL=/root/.bun ENV PATH=$BUN_INSTALL/bin:/usr/local/bin:$PATH # Install OpenCode CLI RUN bun install -g opencode-ai && \ echo "=== OpenCode CLI installed ===" && \ which opencode && \ opencode --version # Copy and install oh-my-opencode from local source COPY package.json bun.lock tsconfig.json /tmp/oh-my-opencode/ COPY src/ /tmp/oh-my-opencode/src/ COPY script/ /tmp/oh-my-opencode/script/ COPY assets/ /tmp/oh-my-opencode/assets/ RUN cd /tmp/oh-my-opencode && \ bun install && \ bun run build && \ npm install -g . && \ echo "=== oh-my-opencode installed from local source ===" && \ rm -rf /tmp/oh-my-opencode # Create workspace and config directories WORKDIR /workspace # Shared config directory - all agents read from here RUN mkdir -p /shared/config \ /shared/claude \ /shared/skills \ /shared/commands \ /shared/agents \ /data/artifacts \ /data/reports \ /data/logs # Set environment for shared config ENV XDG_CONFIG_HOME=/shared/config ENV HOME=/root ENV NODE_ENV=development ENV OH_MY_OPENCODE_ENABLED=true # Add convenient alias for attaching to local server RUN echo "alias opencode='opencode attach http://localhost:8080'" >> /root/.bashrc # Copy config files (from docker directory) COPY docker/shared-config/ /shared/config/ # Set bash as default shell SHELL ["/bin/bash", "-c"] # Verify plugin installation and configuration RUN echo "=== DEBUG: Final Plugin Verification ===" && \ echo "OpenCode location:" && which opencode && \ echo "OpenCode version:" && opencode --version && \ echo "ripgrep version:" && rg --version | head -1 && \ echo "ast-grep version:" && sg --version && \ echo "Configuration check:" && \ cat /shared/config/opencode.jsonc | jq '.plugin' 2>/dev/null || echo "Config not readable" && \ echo "Plugin directory check:" && \ ls -la /shared/config/ 2>/dev/null || echo "Config dir not accessible" && \ echo "Testing basic OpenCode functionality:" && \ timeout 5 opencode --help >/dev/null 2>&1 && echo "OpenCode CLI working" || echo "OpenCode CLI issue" && \ echo "=== DEBUG: Verification complete ===" # Start OpenCode server EXPOSE 8080 CMD ["sh", "-c", "echo '=== Starting OpenCode Server ===' && echo 'Server will be available at http://localhost:8080' && opencode serve --hostname 0.0.0.0 --port 8080 --mdns 2>&1 | tee /var/log/opencode.log"]