From aaadc69f1407bd68f8940979c22a9aa0c36efd27 Mon Sep 17 00:00:00 2001 From: jingrow Date: Fri, 22 Aug 2025 04:17:30 +0800 Subject: [PATCH] =?UTF-8?q?Dockerfile=E4=BC=98=E5=85=88=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E4=B8=8D=E5=B8=A6=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=AE=89=E8=A3=85bench=EF=BC=8C=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=B0=9D=E8=AF=95=E5=B8=A6=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E7=9A=84=E5=AE=89=E8=A3=85=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jcloud/docker/Dockerfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/jcloud/docker/Dockerfile b/jcloud/docker/Dockerfile index b9b7c6d..b66cd88 100644 --- a/jcloud/docker/Dockerfile +++ b/jcloud/docker/Dockerfile @@ -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