-
Notifications
You must be signed in to change notification settings - Fork 612
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
Optimize Dockerfile #1679
Optimize Dockerfile #1679
Conversation
Thank you for you suggestion on improvement. I try and not to modify the default |
The PATH changes I make are the same thing a python virtual environment does when you run the activate script. I do append the existing PATH after the virtual environment location so any commands outside of the virtual environment should still work as expected. The size difference almost certainly has to do with the wheel files from the |
I see what you mean. Quickly looking, there may be something with |
I did some reading on Here are my test results:
masterBuilt off of master with no modifications. mountRemove mount-refactorSame as mount tag, plus removed venvThis current pull request built with python:3.9 build stage and python:3.9-slim final image. |
ef1010b
to
a872868
Compare
Use --mount instead of COPY to reduce image size
a872868
to
d4a52fe
Compare
@amayer5125 Thank you for all the work with this. merging. |
Use a virtual environment to make copying packages from build stage to the final stage easier. It also reduces the image size by 94Mb.
I used
python:3-slim
as the final image. Previously we were usingpython:3.9-slim
. I think using the newer python version is a good idea, but I can change it back if we don't want to use the newer version.Size comparison: