FROM quay.io/ascend/vllm-ascend:v0.30.0-a3
USER root
RUN chmod -R a+rX "/vllm-workspace/vllm-ascend"
RUN echo "配置华为云APT源..." && \
cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
sed -i 's@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g' /etc/apt/sources.list && \
sed -i 's@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g' /etc/apt/sources.list && \
echo "华为云APT源配置完成"
RUN apt-get update && \
apt-get install -y \
sudo \
zip \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ARG TARGETARCH
RUN echo "Building for architecture: $TARGETARCH" && \
case "$TARGETARCH" in \
amd64|x86_64) TTYD_URL="https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.x86_64" ;; \
arm64|aarch64) TTYD_URL="https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.aarch64" ;; \
*) echo "Unsupported arch: $TARGETARCH"; exit 1 ;; \
esac \
&& curl -fsSL "$TTYD_URL" -o /usr/local/bin/ttyd \
&& chmod +x /usr/local/bin/ttyd
WORKDIR /repositories
ARG CACHEBUST=1
RUN --mount=type=secret,id=git_credentials,target=/tmp/.git-credentials,required \
test -n "${CACHEBUST}" \
&& set -eux \
&& cp /tmp/.git-credentials /root/.git-credentials \
&& git config --global credential.helper store \
&& git config --global url."https://gitcode.com/".insteadOf "git@gitcode.com:" \
&& export GIT_TERMINAL_PROMPT=0 \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/gmq123/mofix-new.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/MoFixGo/adapt-agent.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/MoFixGo/deploy-agent.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/MoFixGo/doc-agent.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/MoFixGo/optimization-agent.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/MoFixGo/quantify-agent.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/MoFixGo/search-agent.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/gmq123/model-agent-eval-core.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/MoFixGo/verify-agent.git \
&& git clone --depth 1 --recurse-submodules -b v2.0.0 --single-branch https://gitcode.com/LucciC/pta-helper.git \
&& git clone https://gitee.com/lordstar-habile/huaweicloud-lts-python-sdk.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/cann/cannbot-skills.git \
&& git clone --depth 1 --recurse-submodules https://gitcode.com/Ascend/msagent.git \
&& for repo in mofix-new model-agent-eval-core adapt-agent deploy-agent doc-agent optimization-agent quantify-agent search-agent verify-agent pta-helper huaweicloud-lts-python-sdk cannbot-skills msagent; do \
printf '%s %s\n' "$repo" "$(git -C "$repo" rev-parse HEAD)"; \
done | sort > /repositories/dependency-revisions.txt \
&& git config --global --unset credential.helper \
&& git config --global --unset url."https://gitcode.com/".insteadOf \
&& rm -rf mofix-new/.git adapt-agent/.git deploy-agent/.git doc-agent/.git optimization-agent/.git quantify-agent/.git search-agent/.git model-agent-eval-core/.git verify-agent/.git \
&& rm -rf /root/.git-credentials
RUN mkdir -p /root/.config/pip \
&& echo "[global]" > /root/.config/pip/pip.conf && \
echo "index-url = https://pypi.tuna.tsinghua.edu.cn/simple" >> /root/.config/pip/pip.conf && \
echo "extra-index-url = https://repo.huaweicloud.com/repository/pypi/simple" >> /root/.config/pip/pip.conf && \
echo "trusted-host = pypi.tuna.tsinghua.edu.cn repo.huaweicloud.com" >> /root/.config/pip/pip.conf && \
echo "timeout = 120" >> /root/.config/pip/pip.conf && \
echo "retries = 5" >> /root/.config/pip/pip.conf
RUN pip install ml-dtypes tornado \
&& pip install --no-cache-dir -r mofix-new/requirements.txt
RUN python pta-helper/pta_helper.py --setup
RUN pip install --no-cache-dir claude-agent-sdk==0.2.110
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g @anthropic-ai/claude-code @anthropic-ai/claude-agent-sdk@0.3.177 \
--registry=https://mirrors.huaweicloud.com/repository/npm/ \
--timeout=300000 \
--fetch-retries=3 \
--fetch-retry-mintimeout=20000 \
--fetch-retry-maxtimeout=120000 \
|| npm install -g @anthropic-ai/claude-code @anthropic-ai/claude-agent-sdk@0.3.177 \
--registry=https://registry.npmmirror.com \
--timeout=300000 --fetch-retries=3
RUN curl -fsSL https://raw.atomgit.com/atomgit_atomcode/atomcode/raw/main/scripts/install.sh | sh
RUN atomcode plugin marketplace add https://gitcode.com/gmq123/ascend-model-agent-plugin
RUN atomcode plugin install ascend-model-agent-plugin@ascend-model-agent-plugin
RUN mv /root/.atomcode /workspace
RUN echo "创建 atomgit 用户与用户组..." && \
groupadd -g 1000 -r atomgitgroup && \
useradd -u 1000 -m -g atomgitgroup -s /bin/bash atomgit && \
usermod -aG sudo atomgit && \
echo "atomgit ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/atomgit && \
chmod 0440 /etc/sudoers.d/atomgit && \
mkdir -p /opt/atomgit && \
chown -R atomgit:atomgitgroup /opt/atomgit && \
echo "✅ atomgit 用户已创建并授予 sudo 权限"
RUN mkdir -p /workspace \
&& cd /repositories && zip -qr /workspace/mofix-new.zip . \
&& mv mofix-new/skills /workspace/ \
&& chown -R atomgit:atomgitgroup /workspace \
&& rm -rf /repositories
USER atomgit
RUN printf '%s\n' \
'' \
'# MoFix managed interactive shell defaults.' \
'case "$-" in' \
' *i*) stty sane 2>/dev/null || true; stty -ixon -tostop 2>/dev/null || true ;;' \
'esac' \
>> /home/atomgit/.bashrc \
&& printf '%s\n' \
'" MoFix managed Vim defaults for container editing.' \
'nnoremap <silent> <C-S> :write<CR>' \
'inoremap <silent> <C-S> <C-O>:write<CR>' \
'vnoremap <silent> <C-S> <Esc>:write<CR>gv' \
'nnoremap <C-Z> <Nop>' \
'inoremap <C-Z> <Nop>' \
'vnoremap <C-Z> <Nop>' \
>> /home/atomgit/.vimrc
RUN mkdir -p ~/.claude
RUN mv /workspace/skills ~/.claude/
RUN mkdir -p ~/.atomcode/
ADD docker/config.toml /opt/atomgit/.atomcode/
ADD docker/config.toml /home/atomgit/.atomcode/
ADD docker/config.toml /opt/atomgit/conf/
WORKDIR /opt/atomgit
EXPOSE 8501