Dockerfile优先使用不带环境变量的方式安装bench,失败尝试带环境变量的安装方式

This commit is contained in:
jingrow 2025-08-22 04:17:30 +08:00
parent 05ea0e3dc0
commit aaadc69f14

View File

@ -181,15 +181,21 @@ RUN --mount=type=cache,target=/home/jingrow/.cache,uid=1000,gid=1000 npm install
# Install Bench
ENV PATH "$PATH:/home/jingrow/.local/bin"
# Set environment variables first
{% for v in pg.environment_variables %}
ENV {{v.key}} {{ v.value }}
{% endfor %}
# Install Bench
ENV PATH "$PATH:/home/jingrow/.local/bin"
RUN wget https://bootstrap.pypa.io/get-pip.py && python${PYTHON_VERSION} get-pip.py `#stage-pre-pip`
RUN python${PYTHON_VERSION} -m pip install --upgrade pip `#stage-pre-pip-upgrade`
RUN python${PYTHON_VERSION} -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple `#stage-pre-pip-mirror`
RUN python${PYTHON_VERSION} -m pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn `#stage-pre-pip-trusted`
ENV {{ pg.get_dependency_version("bench", True) }}
RUN --mount=type=cache,target=/home/jingrow/.cache,uid=1000,gid=1000 python${PYTHON_VERSION} -m pip install --upgrade --resume-retries 5 --timeout 100 git+http://git.jingrow.com/jingrow/bench.git `#stage-bench-bench`
# Now bench install command can use the environment variables
RUN --mount=type=cache,target=/home/jingrow/.cache,uid=1000,gid=1000 python${PYTHON_VERSION} -m pip install --upgrade --resume-retries 5 --timeout 100 git+http://git.jingrow.com/jingrow/bench.git || python${PYTHON_VERSION} -m pip install --upgrade --resume-retries 5 --timeout 100 git+http://$GIT_USERNAME:$GIT_ACCESS_TOKEN@git.jingrow.com/jingrow/bench.git `#stage-bench-bench`
RUN --mount=type=cache,target=/home/jingrow/.cache,uid=1000,gid=1000 python${PYTHON_VERSION} -m pip install Jinja2~=3.0.3
RUN --mount=type=cache,target=/home/jingrow/.cache,uid=1000,gid=1000 python${PYTHON_VERSION} -m pip install --upgrade setuptools
@ -200,11 +206,6 @@ ENV PYTHONUNBUFFERED 1
# For the sake of completing the step
RUN `#stage-bench-env`
# Set environment variables
{% for v in pg.environment_variables %}
ENV {{v.key}} {{ v.value }}
{% endfor %}
# Install Jingrow app
ENV PIP_RETRIES=10
ENV PIP_TIMEOUT=300