Skip to content

Commit e9a26da

Browse files
authored
Don't upgrade pip if there are no requirements. (#1678)
1 parent 4be7bfd commit e9a26da

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "truss"
3-
version = "0.9.96rc018"
3+
version = "0.9.97rc001"
44
description = "A seamless bridge from model development to model delivery"
55
license = "MIT"
66
readme = "README.md"

truss/templates/base.Dockerfile.jinja

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ RUN $PYTHON_EXECUTABLE -c "import sys; \
1313
|| { echo "ERROR: Supplied base image does not have {{ min_supported_python_version_in_custom_base_image }} <= python <= {{ max_supported_python_version_in_custom_base_image }}"; exit 1; }
1414
{% endblock %}
1515

16-
RUN pip install --upgrade pip --no-cache-dir \
17-
&& rm -rf /root/.cache/pip
16+
# NB(nikhil): Only run `pip` if present in image, certain custom servers don't have it.
17+
RUN if command -v pip >/dev/null 2>&1; then \
18+
pip install --upgrade pip --no-cache-dir && rm -rf /root/.cache/pip; \
19+
fi
1820

1921
{% block base_image_patch %}
2022
{% endblock %}

truss/tests/test_data/server.Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ RUN $PYTHON_EXECUTABLE -c "import sys; \
99
and sys.version_info.minor <= 13 \
1010
else sys.exit(1)" \
1111
|| { echo "ERROR: Supplied base image does not have 3.8 <= python <= 3.13"; exit 1; }
12-
RUN pip install --upgrade pip --no-cache-dir \
13-
&& rm -rf /root/.cache/pip
12+
RUN if command -v pip >/dev/null 2>&1; then \
13+
pip install --upgrade pip --no-cache-dir && rm -rf /root/.cache/pip; \
14+
fi
1415
ENV PYTHONUNBUFFERED="True"
1516
ENV DEBIAN_FRONTEND="noninteractive"
1617
RUN apt update && \

0 commit comments

Comments
 (0)