AgentEvalTool/deploy/ci/Dockerfile
sinohqb b451ac9625
Some checks are pending
CI / test (push) Waiting to run
feat(ci-cd): add self-hosted Gitea Actions runner + CI & production CD
- CI image (deploy/ci/Dockerfile) with warm deps, no GitHub/Docker Hub dependency
- act_runner deployment templates (compose/config/.env) for Gitea host 47.111.21.147
- Rewrite ci.yml: manual git clone (GITHUB_TOKEN), runs-on agenteval-ci, reuse ci-check.sh
- Add cd-production.yml: tag v*/dispatch trigger, test gate + version gate + ssh deploy
  via scripts/deploy-volcengine-102.sh (unchanged)
- t480 stays manual (internal network, unreachable from Gitea host)
2026-08-12 15:02:29 +08:00

54 lines
2.5 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Gitea Actions CI 镜像runner label: agenteval-ci
# 预装 Python 3.11 + Node 20 + git/openssh/rsync + 项目依赖缓存。
# 基础镜像全部来自私有 registry 的 mirror构建/运行均不触达 Docker Hub / GitHub。
#
# 构建与推送(在 Gitea 服务器或任意 linux/amd64 且能访问 registry 的机器上):
# docker build -f deploy/ci/Dockerfile -t registry.solahqb22.cn/ci/agenteval-ci:latest .
# docker push registry.solahqb22.cn/ci/agenteval-ci:latest
# 注意:本地 macOS(arm64) 构建必须 --platform linux/amd64 并直接 --push推荐在 Gitea 服务器上构建。
FROM registry.solahqb22.cn/mirror/node:20-bookworm AS node
FROM registry.solahqb22.cn/mirror/python:3.11-slim-bookworm
# Node 20复制官方 node 镜像的二进制与内置 npm/corepack
COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& ln -sf /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
&& ln -sf /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack \
&& node --version && npm --version
# 国内镜像源pip / npm / apt
ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ \
PIP_TRUSTED_HOST=mirrors.aliyun.com \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
NPM_CONFIG_REGISTRY=https://registry.npmmirror.com \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
RUN sed -i \
-e 's|deb.debian.org|mirrors.aliyun.com|g' \
-e 's|security.debian.org|mirrors.aliyun.com/debian-security|g' \
/etc/apt/sources.list.d/debian.sources \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
git openssh-client rsync curl ca-certificates gcc jq \
&& rm -rf /var/lib/apt/lists/*
# 骨架 trick 预热 Python 依赖:依赖列表以 pyproject.toml 为唯一数据源,
# CI 时 `pip install -e ".[dev]"` 全命中已装依赖,秒级完成。
WORKDIR /opt/seed
COPY pyproject.toml README.md ./
RUN mkdir -p backend/agenteval backend/cli \
&& touch backend/agenteval/__init__.py backend/cli/__init__.py \
&& pip install --no-cache-dir ".[dev]"
# 预热 npm 缓存:~/.npm 留在镜像层CI 的 `npm ci` 主要命中本地缓存
COPY frontend/web/package.json frontend/web/package-lock.json ./frontend/web/
RUN cd frontend/web && npm ci --ignore-scripts --no-audit --no-fund
WORKDIR /
RUN rm -rf /opt/seed
CMD ["bash"]