diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 44b98e0..22386ee 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -36,7 +36,11 @@ jobs: - name: Install dependencies run: | python3 -m venv .venv-ci - .venv-ci/bin/python -m pip install -r requirements-dev.txt + .venv-ci/bin/python -m pip install \ + --index-url https://mirrors.aliyun.com/pypi/simple \ + --timeout 120 \ + --retries 5 \ + -r requirements-dev.txt - name: Check migrations working-directory: backend run: ../.venv-ci/bin/python manage.py makemigrations --check --dry-run @@ -57,4 +61,7 @@ jobs: .venv-ci/bin/python backend/manage.py migrate --noinput .venv-ci/bin/python -m pytest -q - name: Build image - run: docker build -t hulumath:${{ gitea.sha }} . + run: | + docker build \ + --build-arg PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple \ + -t hulumath:${{ gitea.sha }} . diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 196e392..12e2b03 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -43,7 +43,11 @@ jobs: - name: 安装测试依赖 run: | python3 -m venv .venv-ci - .venv-ci/bin/python -m pip install -r requirements-dev.txt + .venv-ci/bin/python -m pip install \ + --index-url https://mirrors.aliyun.com/pypi/simple \ + --timeout 120 \ + --retries 5 \ + -r requirements-dev.txt - name: 检查迁移文件 working-directory: backend diff --git a/Dockerfile b/Dockerfile index 3ce073e..f2f24dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,12 @@ FROM python:3.11-slim AS runtime +ARG PIP_INDEX_URL=https://pypi.org/simple + ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ - PIP_DISABLE_PIP_VERSION_CHECK=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 \ + PIP_INDEX_URL=$PIP_INDEX_URL \ + PIP_DEFAULT_TIMEOUT=120 WORKDIR /app