-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
build: Reduce intermediate layers #7408
Conversation
What is the improvement with this change? |
It seems like every Dockerfile command, e.g. FROM, , RUN, etc. creates an image layer of its own. The layers are then used to assemble the final image. With more accumulated layers, the image will be increased in size. |
rm -fr ${TRT_ROOT}/bin ${TRT_ROOT}/targets/${ARCH}-linux-gnu/bin ${TRT_ROOT}/data && \ | ||
rm -fr ${TRT_ROOT}/doc ${TRT_ROOT}/onnx_graphsurgeon ${TRT_ROOT}/python && \ | ||
rm -fr ${TRT_ROOT}/samples ${TRT_ROOT}/targets/${ARCH}-linux-gnu/samples && \ | ||
python3 -m pip install --upgrade pip && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather keep pip
to have clean docker file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean just run pip install
instead of python3 -m pip install
?
RUN pip3 install setuptools==69.5.1 grpcio-tools==1.64.0 | ||
RUN ldconfig && \ | ||
ARCH="$(uname -i)" && \ | ||
rm -fr ${TRT_ROOT}/bin ${TRT_ROOT}/targets/${ARCH}-linux-gnu/bin ${TRT_ROOT}/data && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double slash \\
in the and is an escape symbol was to give developers more clean and readable Dockerfile
output. Not sure if it make sense to remove it.
Idea behind image layers is to keep layer history transparent. |
Is there before / after comparison in terms of image size? |
@GuanLuo The container size from the latest pipeline is now only 24.7G, reducing by 8.7G. |
Will create a follow up PR to address @mc-nv's comments. |
What does the PR do?
Reduce intermediate layers in order to reduce TRT-LLM container size.
Checklist
<commit_type>: <Title>
Commit Type:
Check the conventional commit type
box here and add the label to the github PR.
Related PRs:
Where should the reviewer start?
Test plan:
TRT-LLM backend build + tests should pass.
Caveats:
Background
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)