-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Cleaner dockerfile #13162
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
Cleaner dockerfile #13162
Conversation
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
Hi @fopina thank you for your contribution! We are planning to restructure these docker files in the near future to accommodate the points you've raised in addition to some other ones. For now, we would prefer to keep the docker files as is to avoid a moving target. We will absolutely keep your suggestions in mind for when the broader restructuring lands! |
|
Hi @Maffooch thanks for feedback, makes sense and also @valentijnscholten made a change that is similar to one of these commits already What about if I strip this down just to the first commit, to remove wheels from the image (1/6 of the size)? |
|
I think it will also make builds faster? |
|
When I started going through it, I hoped I'd find something to speed up the build, but just keeping the wheels out does not speed it up (apart from pushing it to registry). I think the biggest culprits are uwsgi and psycopg as they're always built. Not a big issue on a decent machine for its own arch but quite noticeable when doing multiplatform builds and using qemu In my case, non-native arch takes about 6min to build with <2min on native one. |
|
re-created a clean PR in #13209 for comparison/consideration |
|
replaced by #13209 |
Description
Buildkit allows mounting during
RUNso we don't need to useCOPYbefore (creating a layer that will persist the wheels).I was going to open PR with just that change but ended up adding a few more suggestions, each in its own commit so it's easier to review/remove (to be squashed later/on merge).
Note that trying to remove things from the production container is not only to reduce build time (irrelevant in these tests) and size (not huge) but also reducing attack surface.
Looking forward any feedback - I think at least the wheel dropping is a solid and harmless win :)
Test results
Command used for test:
time docker build -t x9x -f Dockerfile.django-??? . --progress plain --no-cachedjango-unittests, not thedjangooneChecklist
This checklist is for your information.
dev.dev.bugfixbranch.