From 8883b2acee5846d1dda293f874b4cd7aca3626c6 Mon Sep 17 00:00:00 2001
From: gs-olive <113141689+gs-olive@users.noreply.github.com>
Date: Mon, 28 Aug 2023 18:17:46 -0700
Subject: [PATCH] fix: Unify layers in container cleanup

---
 docker/Dockerfile | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 6d804fb086..471aaf54df 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -104,19 +104,17 @@ RUN mkdir -p "/opt/python3/" &&\
 
 COPY --from=torch-tensorrt-builder  /workspace/torch_tensorrt/src/dist/ .
 
-RUN cp /opt/torch_tensorrt/docker/WORKSPACE.docker /opt/torch_tensorrt/WORKSPACE
-RUN pip install -r /opt/torch_tensorrt/py/requirements.txt
-# Install all dependency wheel files and user-specified TensorRT
-RUN pip install *.whl
-RUN pip install tensorrt==${TENSORRT_VERSION}.*
-
-# Add the Torch-TensorRT wheel file to the dist directory and delete all other .whl files
-RUN rm -fr /workspace/torch_tensorrt/dist/*
-RUN mkdir -p /opt/torch_tensorrt/dist/ && mv torch_tensorrt*.whl /opt/torch_tensorrt/dist/
-RUN rm -fr *.whl
-
-# Remove other cache files if present
-RUN pip cache purge && rm -rf /opt/torch_tensorrt/.mypy_cache
+RUN cp /opt/torch_tensorrt/docker/WORKSPACE.docker /opt/torch_tensorrt/WORKSPACE &&\
+    pip install -r /opt/torch_tensorrt/py/requirements.txt &&\
+    # Install all dependency wheel files and user-specified TensorRT
+    pip install *.whl &&\
+    pip install tensorrt==${TENSORRT_VERSION}.* &&\
+    # Add the Torch-TensorRT wheel file to the dist directory and delete all other .whl files
+    rm -fr /workspace/torch_tensorrt/dist/* &&\
+    mkdir -p /opt/torch_tensorrt/dist/ && mv torch_tensorrt*.whl /opt/torch_tensorrt/dist/ &&\
+    rm -fr *.whl &&\
+    # Remove other cache files if present
+    pip cache purge && rm -rf /opt/torch_tensorrt/.mypy_cache
 
 WORKDIR /opt/torch_tensorrt