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