Skip to content

Commit dfbe63e

Browse files
authored
build: Reduce intermediate layers (#7408)
1 parent f5273ee commit dfbe63e

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

build.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,25 +1082,20 @@ def create_dockerfile_linux(
10821082
"""
10831083
if "tensorrtllm" in backends:
10841084
df += """
1085-
1086-
RUN ldconfig
1087-
# Remove contents that are not needed in runtime
1088-
RUN ARCH="$(uname -i)" \\
1089-
&& rm -fr ${TRT_ROOT}/bin ${TRT_ROOT}/targets/${ARCH}-linux-gnu/bin ${TRT_ROOT}/data \\
1090-
&& rm -fr ${TRT_ROOT}/doc ${TRT_ROOT}/onnx_graphsurgeon ${TRT_ROOT}/python \\
1091-
&& rm -fr ${TRT_ROOT}/samples ${TRT_ROOT}/targets/${ARCH}-linux-gnu/samples
1092-
10931085
# Install required packages for TRT-LLM models
1094-
RUN python3 -m pip install --upgrade pip \\
1095-
&& pip3 install transformers
1096-
1097-
# ldconfig for TRT-LLM
1098-
RUN find /usr -name libtensorrt_llm.so -exec dirname {} \; > /etc/ld.so.conf.d/tensorrt-llm.conf
1099-
RUN find /opt/tritonserver -name libtritonserver.so -exec dirname {} \; > /etc/ld.so.conf.d/triton-tensorrtllm-worker.conf
1100-
1086+
# Remove contents that are not needed in runtime
11011087
# Setuptools has breaking changes in version 70.0.0, so fix it to 69.5.1
11021088
# The generated code in grpc_service_pb2_grpc.py depends on grpcio>=1.64.0, so fix it to 1.64.0
1103-
RUN pip3 install setuptools==69.5.1 grpcio-tools==1.64.0
1089+
RUN ldconfig && \
1090+
ARCH="$(uname -i)" && \
1091+
rm -fr ${TRT_ROOT}/bin ${TRT_ROOT}/targets/${ARCH}-linux-gnu/bin ${TRT_ROOT}/data && \
1092+
rm -fr ${TRT_ROOT}/doc ${TRT_ROOT}/onnx_graphsurgeon ${TRT_ROOT}/python && \
1093+
rm -fr ${TRT_ROOT}/samples ${TRT_ROOT}/targets/${ARCH}-linux-gnu/samples && \
1094+
python3 -m pip install --upgrade pip && \
1095+
pip3 install --no-cache-dir transformers && \
1096+
find /usr -name libtensorrt_llm.so -exec dirname {} \; > /etc/ld.so.conf.d/tensorrt-llm.conf && \
1097+
find /opt/tritonserver -name libtritonserver.so -exec dirname {} \; > /etc/ld.so.conf.d/triton-tensorrtllm-worker.conf && \
1098+
pip3 install --no-cache-dir setuptools==69.5.1 grpcio-tools==1.64.0
11041099
11051100
ENV LD_LIBRARY_PATH=/usr/local/tensorrt/lib/:/opt/tritonserver/backends/tensorrtllm:$LD_LIBRARY_PATH
11061101
"""

0 commit comments

Comments
 (0)