Skip to content

Commit

Permalink
fix: Unify layers in Docker Container Cleanup (pytorch#2275)
Browse files Browse the repository at this point in the history
  • Loading branch information
gs-olive authored Aug 29, 2023
1 parent 8efbee9 commit 0e5a497
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0e5a497

Please sign in to comment.