Skip to content

Remove python checks and deps from custom server #1272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "truss"
version = "0.9.56rc0"
version = "0.9.56.dev2"
description = "A seamless bridge from model development to model delivery"
license = "MIT"
readme = "README.md"
Expand Down
11 changes: 0 additions & 11 deletions truss/templates/base.Dockerfile.jinja
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
ARG PYVERSION={{config.python_version}}
FROM {{base_image_name_and_tag}} AS truss_server

ENV PYTHON_EXECUTABLE="{{ config.base_image.python_executable_path or 'python3' }}"

{% block fail_fast %}
RUN grep -w 'ID=debian\|ID_LIKE=debian' /etc/os-release || { echo "ERROR: Supplied base image is not a debian image"; exit 1; }
RUN $PYTHON_EXECUTABLE -c "import sys; sys.exit(0) if sys.version_info.major == {{supported_python_major_version_in_custom_base_image}} and sys.version_info.minor >={{min_supported_python_minor_version_in_custom_base_image}} and sys.version_info.minor <={{max_supported_python_minor_version_in_custom_base_image}} else sys.exit(1)" \
|| { 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; }
{% endblock %}

RUN pip install --upgrade pip --no-cache-dir \
&& rm -rf /root/.cache/pip

{% block base_image_patch %}
{% endblock %}

Expand Down
1 change: 0 additions & 1 deletion truss/templates/docker_server_requirements.txt

This file was deleted.

19 changes: 16 additions & 3 deletions truss/templates/server.Dockerfile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@
# If user base image is supplied in config, apply build commands from truss base image
{% if config.base_image %}
{%- if not config.docker_server %}

{% block fail_fast %}
RUN grep -w 'ID=debian\|ID_LIKE=debian' /etc/os-release || { echo "ERROR: Supplied base image is not a debian image"; exit 1; }
RUN $PYTHON_EXECUTABLE -c "import sys; sys.exit(0) if sys.version_info.major == {{supported_python_major_version_in_custom_base_image}} and sys.version_info.minor >={{min_supported_python_minor_version_in_custom_base_image}} and sys.version_info.minor <={{max_supported_python_minor_version_in_custom_base_image}} else sys.exit(1)" \
|| { 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; }


ENV PYTHON_EXECUTABLE="{{ config.base_image.python_executable_path or 'python3' }}"

RUN pip install --upgrade pip --no-cache-dir \
&& rm -rf /root/.cache/pip

{% endblock %}


ENV PYTHONUNBUFFERED="True"
ENV DEBIAN_FRONTEND="noninteractive"

Expand Down Expand Up @@ -100,10 +115,8 @@ COPY ./{{ config.model_module_dir }} /app/model
{% block run %}
{%- if config.docker_server %}
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
curl nginx python3-pip && \
curl nginx supervisor && \
rm -rf /var/lib/apt/lists/*
COPY ./docker_server_requirements.txt /app/docker_server_requirements.txt
RUN pip install -r /app/docker_server_requirements.txt --no-cache-dir && rm -rf /root/.cache/pip
{% set proxy_config_path = "/etc/nginx/conf.d/proxy.conf" %}
{% set supervisor_config_path = "/etc/supervisor/supervisord.conf" %}
{% set supervisor_log_dir = "/var/log/supervisor" %}
Expand Down
Loading