Skip to content

Commit 0792084

Browse files
authored
Merge pull request #1698 from basetenlabs/bump-version-0.9.101
Release 0.9.101
2 parents 4798790 + 6e930e5 commit 0792084

File tree

5 files changed

+39
-26
lines changed

5 files changed

+39
-26
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.100"
3+
version = "0.9.101"
44
description = "A seamless bridge from model development to model delivery"
55
license = "MIT"
66
readme = "README.md"

truss/contexts/local_loader/docker_build_emulator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def _resolve_values(keys: List[str]) -> List[str]:
5353
if cmd.instruction == DockerInstruction.ENTRYPOINT:
5454
result.entrypoint = list(values)
5555
if cmd.instruction == DockerInstruction.COPY:
56+
# NB(nikhil): Skip COPY commands with --from flag (multi-stage builds)
57+
if len(values) != 2:
58+
continue
59+
5660
src, dst = values
5761
src = src.replace("./", "", 1)
5862
dst = dst.replace("/", "", 1)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{%- if requires_live_reload %}
2+
FROM python:{{ control_python_version }}-slim as control-server-venv
3+
4+
RUN echo "Creating venv for py{{ control_python_version }}";
5+
RUN python -m pip install --upgrade pip
6+
RUN python -m venv --copies /control/.env
7+
RUN echo "Created venv for py{{ control_python_version }}";
8+
{%- endif %} {#- endif requires_live_reload #}

truss/templates/server.Dockerfile.jinja

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
{%- include "cache.Dockerfile.jinja" %}
33
{%- endif %} {#- endif model_cache_v1 #}
44

5+
{%- set requires_live_reload = config.live_reload and not config.docker_server %}
6+
7+
{%- if requires_live_reload %}
8+
{% include "control_venv.Dockerfile.jinja" %}
9+
{%- endif %} {#- endif requires_live_reload #}
10+
511
{% extends "base.Dockerfile.jinja" %}
612

13+
714
{% block base_image_patch %}
815
{# If user base image is supplied in config, apply build commands from truss base image #}
916
{% if config.base_image %}
@@ -27,14 +34,14 @@ COPY ./{{ base_server_requirements_filename }} {{ base_server_requirements_filen
2734
RUN pip install -r {{ base_server_requirements_filename }} --no-cache-dir && rm -rf /root/.cache/pip
2835
{%- endif %} {#- endif not config.docker_server #}
2936

30-
{%- if config.live_reload and not config.docker_server %}
37+
{%- if requires_live_reload %}
3138
{# Create symlink for inference server IF a user base image is supplied and live_reload is enabled. #}
3239
{# This links the base images primary python executable path to /usr/local/bin/python. #}
3340
{# This is specific to the user-provided base image scenario. #}
3441
RUN readlink {{ config.base_image.python_executable_path }} &>/dev/null \
3542
&& echo "WARNING: Overwriting existing link at /usr/local/bin/python"
3643
RUN ln -sf {{ config.base_image.python_executable_path }} /usr/local/bin/python
37-
{%- endif %} {#- endif config.live_reload and not config.docker_server (for symlink) #}
44+
{%- endif %} {#- endif requires_live_reload #}
3845
{% endif %} {#- endif config.base_image #}
3946

4047
{% endblock %} {#- endblock base_image_patch #}
@@ -91,34 +98,24 @@ COPY ./truss /app/truss
9198
{%- endif %} {#- endif use_local_src #}
9299

93100
COPY ./config.yaml /app/config.yaml
94-
{%- if config.live_reload and not config.docker_server %}
101+
{%- if requires_live_reload %}
95102
COPY ./control /control
96-
# Step 1: Ensure a usable python{{ control_python_version }} is available
97-
RUN if python{{ control_python_version }} -c 'import venv; venv.EnvBuilder(with_pip=True).create("/tmp/__probe_env")' > /dev/null 2>&1; then \
98-
echo "Using system python{{ control_python_version }}"; \
99-
python{{ control_python_version }} -m pip install --upgrade pip virtualenv && \
100-
python{{ control_python_version }} -m virtualenv /control/.env; \
101-
else \
102-
echo "Installing Miniforge-based python{{ control_python_version }}..."; \
103-
curl -fsSL -o miniforge.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh && \
104-
bash miniforge.sh -b -p /opt/conda-control && \
105-
rm miniforge.sh && \
106-
/opt/conda-control/bin/conda create -y -p /opt/conda-control/envs/py{{ control_python_version }} python={{ control_python_version }} && \
107-
/opt/conda-control/envs/py{{ control_python_version }}/bin/pip install --upgrade pip virtualenv && \
108-
/opt/conda-control/bin/conda clean -afy && \
109-
rm -rf /opt/conda-control/pkgs && \
110-
/opt/conda-control/envs/py{{ control_python_version }}/bin/python -m virtualenv /control/.env; \
111-
fi
112-
113-
# Step 2: Install requirements into the freshly created venv
103+
104+
# NB(nikhil): Copy the virtual env, and system dependencies for the
105+
# python version specific to the control server. We need to run ldconfig
106+
# so dynamic linking works.
107+
COPY --from=control-server-venv /usr/local/lib/ /usr/local/lib/
108+
COPY --from=control-server-venv /control/.env /control/.env
109+
RUN ldconfig
110+
114111
RUN /control/.env/bin/pip install -r /control/requirements.txt
115-
{%- endif %} {#- endif config.live_reload and not config.docker_server (for control server setup) #}
112+
{%- endif %} {#- endif requires_live_reload #}
113+
116114
{%- if model_dir_exists %}
117115
COPY ./{{ config.model_module_dir }} /app/model
118116
{%- endif %} {#- endif model_dir_exists #}
119117
{% endblock %} {#- endblock app_copy #}
120118

121-
122119
{% block run %}
123120
{%- if config.docker_server %}
124121
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -136,7 +133,7 @@ COPY supervisord.conf {{ supervisor_config_path }}
136133
ENV SUPERVISOR_SERVER_URL="{{ supervisor_server_url }}"
137134
ENV SERVER_START_CMD="supervisord -c {{ supervisor_config_path }}"
138135
ENTRYPOINT ["supervisord", "-c", "{{ supervisor_config_path }}"]
139-
{%- elif config.live_reload %} {#- elif config.live_reload #}
136+
{%- elif requires_live_reload %} {#- elif requires_live_reload #}
140137
ENV HASH_TRUSS="{{ truss_hash }}"
141138
ENV CONTROL_SERVER_PORT="8080"
142139
ENV INFERENCE_SERVER_PORT="8090"

truss/tests/test_truss_handle.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ def test_build_docker_image(custom_model_truss_dir_with_pre_and_post):
104104
@pytest.mark.parametrize(
105105
"base_image, path, expected_fail",
106106
[
107-
("baseten/truss-server-base:3.9-v0.4.8rc4", "/usr/local/bin/python3", False),
107+
("baseten/truss-server-base:3.9-v0.9.0", "/usr/local/bin/python3", False),
108+
("baseten/truss-server-base:3.10-v0.9.0", "/usr/local/bin/python3", False),
109+
("baseten/truss-server-base:3.11-v0.9.0", "/usr/local/bin/python3", False),
110+
("baseten/truss-server-base:3.12-v0.9.0", "/usr/local/bin/python3", False),
111+
("baseten/truss-server-base:3.13-v0.9.0", "/usr/local/bin/python3", False),
108112
("python:3.8", "/usr/local/bin/python3", False),
109113
("python:3.10", "/usr/local/bin/python3", False),
110114
("python:3.11", "/usr/local/bin/python3", False),

0 commit comments

Comments
 (0)