FROM ubuntu:latest # 1. 基础工具 (包含 Zed 远程运行所需的 procps, tar) RUN apt-get update && apt-get install -y \ curl git wget unzip procps tar gzip shellcheck vim \ gcc g++ make cmake libssl-dev tmux jq \ zsh sudo python3 python3-pip openssh-server \ postgresql-client redis-tools default-mysql-client \ && apt-get clean && rm -rf /var/lib/apt/lists/* # 2. 环境变量 ENV CARGO_HOME=/usr/local/cargo \ RUSTUP_HOME=/usr/local/rustup \ BUN_INSTALL="/root/.bun" \ GOPATH="/root/go" ENV PATH="$BUN_INSTALL/bin:/usr/local/cargo/bin:/usr/local/go/bin:$GOPATH/bin:${PATH}" RUN chsh -s /bin/zsh root # 3. 安装 Rust & Bun & Go RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y RUN curl -fsSL https://bun.sh/install | bash RUN curl -fsSL https://go.dev/dl/go1.24.4.linux-amd64.tar.gz | tar -C /usr/local -xzf - \ && go install golang.org/x/tools/gopls@latest \ && go install github.com/go-delve/delve/cmd/dlv@latest \ && mv /root/go/bin/* /usr/local/bin/ # 4. 全局安装 AI 工具 (opencode + oh-my-pi) RUN bun install -g opencode-ai @oh-my-pi/pi-coding-agent # 5. 安装 mise (多语言版本管理器,用于按需管理 Node/Python/Ruby 等) RUN curl -fsSL https://mise.run | MISE_INSTALL_PATH=/usr/local/bin/mise sh \ && echo 'eval "$(mise activate zsh)"' >> /root/.zshrc # 6. SSH & 目录预设 (为 Zed 准备) RUN ssh-keygen -A && \ mkdir -p /root/.zed /root/.local/share/zed && \ sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config RUN sed -i 's/#PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config # 7. Shell 美化 RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended # 接收来自 compose 的参数 ARG CONTAINER_WORKSPACE=/workspace # 设置工作目录 WORKDIR ${CONTAINER_WORKSPACE} COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] CMD ["zsh"]