ai-code/docker-images/Dockerfile.agent
2026-02-27 19:59:11 +00:00

101 lines
3.3 KiB
Text

FROM python:3.12-slim
# 1. Install System Tools
# Added pkg-config and libssl-dev (Essential for Rust compilation)
RUN apt-get update && apt-get install -y \
git curl build-essential unzip sudo \
ffmpeg jq zsh pkg-config libssl-dev wezterm \
default-jdk-headless \
&& rm -rf /var/lib/apt/lists/*
# 2. Install Starship & Aliases
RUN curl -sS https://starship.rs/install.sh | sh -s -- -y
RUN echo 'eval "$(starship init zsh)"' >> /root/.zshrc
RUN echo 'alias ll="ls -al"' >> /root/.zshrc
# Shortcuts for new tools
RUN echo 'alias c="cargo"' >> /root/.zshrc
RUN echo 'alias g="go"' >> /root/.zshrc
# 3. Install 'uv' (Python)
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# 4. Install Bun (JS/TS)
ENV BUN_INSTALL="/root/.bun"
ENV PATH="$BUN_INSTALL/bin:$PATH"
RUN curl -fsSL https://bun.sh/install | bash
# --- NEW SECTION: RUST SETUP ---
# 5. Install Rust (Official Script)
# Installs Cargo, Rustc, Rustfmt, etc.
ENV RUSTUP_HOME=/root/.rustup
ENV CARGO_HOME=/root/.cargo
ENV PATH="$CARGO_HOME/bin:$PATH"
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile default
# --- NEW SECTION: GO SETUP ---
# 6. Install Go (Latest Stable)
# We target 'linux-arm64' because you are on Apple Silicon (M3).
ARG GO_VER=1.23.4
RUN curl -OL https://golang.org/dl/go${GO_VER}.linux-arm64.tar.gz && \
tar -C /usr/local -xzf go${GO_VER}.linux-arm64.tar.gz && \
rm go${GO_VER}.linux-arm64.tar.gz
ENV PATH="/usr/local/go/bin:$PATH"
# 6a basex https://files.basex.org/releases/12.2/BaseX122.zip
ARG BASEX_VER=12.2/BaseX122.zip
RUN curl -fsSL https://files.basex.org/releases/${BASEX_VER} -o temp.zip || { echo "Download failed"; exit 1; } && \
unzip temp.zip -d /usr/local || { echo "Extraction failed"; rm temp.zip; exit 1; } && \
rm temp.zip
ENV PATH="/usr/local/basex/bin:$PATH"
# 7. Install OpenCode CLI
RUN curl -fsSL https://opencode.ai/install | bash
ENV PATH="/root/.opencode/bin:$PATH"
# 8. Install Oh-My-OpenCode
#RUN bunx oh-my-opencode@latest install --no-tui \
# --claude=no --gemini=no --copilot=no
# 9. CONFIG PART 1: Hardware/Providers (opencode.json)
# Maps your local ports to providers.
RUN mkdir -p /root/.config/opencode && \
cat <<EOF > /root/.config/opencode/opencode.json
{
"plugin": [],
"theme": "system",
"model": "halo/qwen3-coder-next:latest",
"small_model": "halo/gemma3:4b",
"provider": {
"halo": {
"npm": "@ai-sdk/openai-compatible",
"name": "local models",
"options": { "baseURL": "http://host.docker.internal:11434/v1" },
"models": { "hf.co/unsloth/GLM-4.7-Flash-GGUF:Q6_K": { "name": "glm4.7" },
"hf.co/LiquidAI/LFM2-24B-A2B-GGUF:Q8_0": { "name": "lfm2" },
"qwen3-coder-next:latest": { "name": "qwen3" },
"gemma3:4b": {"name": "Gemma"}
}
}
}
}
EOF
# 10. CONFIG PART 2: Agent Brains (oh-my-opencode.json)
# Maps Agent Roles to Providers.
RUN cat <<EOF > /root/.config/opencode/oh-my-opencode.json
{
"agents": {
"Sisyphus": { "model": "halo/glm47" },
"Oracle": { "model": "halo/lfm2" },
"Librarian": { "model": "halo/glm47" },
"Hephaestus": { "model": "halo/qwen3" }
},
"disabled_agents": ["multimodal-looker"],
"confirm_dangerous_actions": false
}
EOF
WORKDIR /workspace
ENV SHELL=/bin/zsh
CMD ["/bin/zsh"]