diff --git a/.woodpecker/ci.yml b/.woodpecker/ci.yml index 8290cb2ff..c5b060ccd 100644 --- a/.woodpecker/ci.yml +++ b/.woodpecker/ci.yml @@ -6,6 +6,9 @@ when: steps: lint: image: python:3.12-slim + environment: + PIP_DEFAULT_TIMEOUT: "120" + PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple commands: - cd coding-agent - python -m pip install -e '.[dev,redis]' ruff @@ -13,6 +16,9 @@ steps: smoke-tests: image: python:3.12-slim + environment: + PIP_DEFAULT_TIMEOUT: "120" + PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple commands: - cd coding-agent - python -m pip install -e '.[dev,redis]' @@ -33,13 +39,16 @@ steps: from_secret: proxy_url HTTPS_PROXY: from_secret: proxy_url + PIP_DEFAULT_TIMEOUT: "120" + PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple + UV_DEFAULT_INDEX: https://pypi.tuna.tsinghua.edu.cn/simple no_proxy: git.mesh.kinaz.me,localhost,127.0.0.1,.svc,.cluster.local,10.0.0.0/8,192.168.0.0/16 NO_PROXY: git.mesh.kinaz.me,localhost,127.0.0.1,.svc,.cluster.local,10.0.0.0/8,192.168.0.0/16 commands: - mkdir -p /kaniko/.docker - auth="$(printf '%s:%s' "$REGISTRY_USERNAME" "$REGISTRY_PASSWORD" | base64 | tr -d '\n')" - printf '{"auths":{"git.mesh.kinaz.me":{"auth":"%s"}}}\n' "$auth" > /kaniko/.docker/config.json - - /kaniko/executor --context "$CI_WORKSPACE/coding-agent" --dockerfile "$CI_WORKSPACE/coding-agent/Dockerfile" --build-arg PYTHON_BASE_IMAGE=git.mesh.kinaz.me/kina/python:3.12-slim --destination "git.mesh.kinaz.me/kina/coding-agent:${CI_COMMIT_SHA}" --destination "git.mesh.kinaz.me/kina/coding-agent:main" + - /kaniko/executor --context "$CI_WORKSPACE/coding-agent" --dockerfile "$CI_WORKSPACE/coding-agent/Dockerfile" --build-arg PYTHON_BASE_IMAGE=git.mesh.kinaz.me/kina/python:3.12-slim --build-arg PIP_DEFAULT_TIMEOUT="$PIP_DEFAULT_TIMEOUT" --build-arg PIP_INDEX_URL="$PIP_INDEX_URL" --build-arg UV_DEFAULT_INDEX="$UV_DEFAULT_INDEX" --destination "git.mesh.kinaz.me/kina/coding-agent:${CI_COMMIT_SHA}" --destination "git.mesh.kinaz.me/kina/coding-agent:main" when: - event: - push diff --git a/coding-agent/Dockerfile b/coding-agent/Dockerfile index bc9f4c6c2..ec9565a96 100644 --- a/coding-agent/Dockerfile +++ b/coding-agent/Dockerfile @@ -20,19 +20,24 @@ RUN pnpm build FROM ${PYTHON_BASE_IMAGE} AS builder +ARG PIP_DEFAULT_TIMEOUT=120 +ARG PIP_INDEX_URL=https://pypi.org/simple +ARG UV_DEFAULT_INDEX=https://pypi.org/simple + ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ + PIP_DEFAULT_TIMEOUT=${PIP_DEFAULT_TIMEOUT} \ UV_LINK_MODE=copy WORKDIR /app -RUN pip install --no-cache-dir uv +RUN PIP_INDEX_URL="${PIP_INDEX_URL}" pip install --no-cache-dir uv COPY pyproject.toml uv.lock README.md ./ COPY src ./src -RUN uv sync --frozen --no-dev -RUN uv pip install --python /app/.venv/bin/python redis +RUN UV_DEFAULT_INDEX="${UV_DEFAULT_INDEX}" uv sync --frozen --no-dev +RUN UV_DEFAULT_INDEX="${UV_DEFAULT_INDEX}" uv pip install --python /app/.venv/bin/python redis FROM ${PYTHON_BASE_IMAGE} AS runtime