Skip to content

Commit 65c6494

Browse files
authored
fix: Decrease Docker container size by 20% (#2257)
1 parent fabfc55 commit 65c6494

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docker/Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,17 @@ COPY --from=torch-tensorrt-builder /workspace/torch_tensorrt/src/dist/ .
106106

107107
RUN cp /opt/torch_tensorrt/docker/WORKSPACE.docker /opt/torch_tensorrt/WORKSPACE
108108
RUN pip install -r /opt/torch_tensorrt/py/requirements.txt
109+
# Install all dependency wheel files and user-specified TensorRT
110+
RUN pip install *.whl
109111
RUN pip install tensorrt==${TENSORRT_VERSION}.*
110-
RUN pip install *.whl && rm -fr /workspace/torch_tensorrt/dist/* *.whl
112+
113+
# Add the Torch-TensorRT wheel file to the dist directory and delete all other .whl files
114+
RUN rm -fr /workspace/torch_tensorrt/dist/*
115+
RUN mkdir -p /opt/torch_tensorrt/dist/ && mv torch_tensorrt*.whl /opt/torch_tensorrt/dist/
116+
RUN rm -fr *.whl
117+
118+
# Remove other cache files if present
119+
RUN pip cache purge && rm -rf /opt/torch_tensorrt/.mypy_cache
111120

112121
WORKDIR /opt/torch_tensorrt
113122

0 commit comments

Comments
 (0)