| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- FROM python:3.11-slim
- ENV PYTHONUNBUFFERED=1 \
- PYTHONDONTWRITEBYTECODE=1 \
- NONINTERACTIVE=1 \
- CI=1 \
- HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api" \
- HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git" \
- HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git" \
- HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles" \
- FNM_DIR=/home/agent/.fnm \
- FNM_NODE_DIST_MIRROR=https://mirrors.ustc.edu.cn/node/ \
- PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/agent/.fnm:/home/agent/.fnm/bin:$PATH"
- # 1、安装必要的软件包
- RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources \
- && apt-get update && apt-get install -y --no-install-recommends \
- sudo git curl ca-certificates zip unzip tar build-essential pkg-config jq ripgrep \
- && rm -rf /var/lib/apt/lists/*
- # 2、创建 agent 用户与共享目录
- RUN useradd -m agent && echo "agent ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
- && mkdir -p /home/agent/workspace /home/agent/shared \
- && chown -R agent:agent /home/agent/workspace /home/agent/shared
- USER agent
- WORKDIR /home/agent/workspace
- # 3、安装 Homebrew
- RUN /bin/bash -c "$(curl -fsSL https://mirrors.ustc.edu.cn/misc/brew-install.sh)" \
- && echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)"' >> /home/agent/.bashrc \
- && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)" \
- && brew update
- # 4、配置 Python 镜像
- RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ \
- && pip config set install.trusted-host mirrors.aliyun.com
- # 5、安装 fnm + node
- RUN brew install fnm \
- && echo 'eval "$(fnm env --shell bash)"' >> /home/agent/.bashrc \
- && eval "$(fnm env --shell bash)" \
- && fnm install 24 \
- && fnm use 24 \
- && npm config set registry https://registry.npmmirror.com
- VOLUME [ "/home/agent/workspace", "/home/agent/shared" ]
- ENTRYPOINT [ "sleep", "infinity" ]
|