Repository navigation
Prevent removing unexpected .a files in case of re-using the Dockerfile to build custom image - #706
Merged
tianon merged 3 commits intoMar 24, 2022
Conversation
Member
|
Interesting! I'm not opposed but I'd definitely like to do a more thorough check of other versions and variants just to be sure. 😅 🙈 (It'd be even cooler if we could find some way to convince Python not to build or install this file in the first place, but I'm not going to wish too hard for that one 😄) |
Contributor
Author
|
Thanks for the comment!
Sure! Then maybe I can proceed to run |
tianon
force-pushed
the
fix-removing-unexpected-dot-a-files
branch
from
March 24, 2022 22:00
26ebe77 to
3b2ca12
Compare
Member
|
Nice, that was more successful than I expected. 😅 🤘 |
docker-library-bot
added a commit
to docker-library-bot/official-images
that referenced
this pull request
Mar 25, 2022
Changes: - docker-library/python@0a9ee3e: Prevent removing unexpected .a files in case of re-using the Dockerfile to build custom image (docker-library/python#706)
docker-library-bot
added a commit
to docker-library-bot/official-images
that referenced
this pull request
Apr 6, 2022
Changes: - docker-library/python@37e4721: Update 3.11-rc to 3.11.0a7, pip 22.0.4 - docker-library/python@0a9ee3e: Prevent removing unexpected .a files in case of re-using the Dockerfile to build custom image (docker-library/python#706)
Omar290601
pushed a commit
to Omar290601/python
that referenced
this pull request
Aug 27, 2025
…le to build custom image (docker-library#706) * Prevent removing unexpected .a files when building Python on top of other images * Add a check in GitHub Actions for leftover ".a" files in "/usr/local" Co-authored-by: Tianon Gravi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello, I'd like to propose a slight change for cleaning up
*.awhich is defined here, so that it doesn't delete unexpected files.python/3.10/slim-buster/Dockerfile
Line 92 in 0047f00
Here is my background:
The current Dockerfile for the dockerhub Python image itself works pretty fine; it doesn't remove anything unexpected, even without my proposal.
However, since this official Dockerfile is so useful, clean and general, we often re-use (borrow) its content to make our own images on top of another image, typically by just rewriting the
FROMsection to something other.For example, which is my actual case, we build a Python-ready image on top of
nvidia/cuda:11.6.0-xxx. The issue here is that removing all the*.aunder/usr/localas written in the current Dockerfile also destroys CUDA libraries. This combination is just an example but I think the same thing can happen in other patterns.Looking at the actual files cleaned up here while building Python 3.10 images for
slim-busterandalpine3.15, I found out/usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.ais the only*.afile removed. So I think modifying the rule for thefindcommand from'*.a'to'libpython*.a'can prevent unexpectedly removing .a files of other libraries in case modifyingFROMsection, while it doesn't change anything on the image for dockerhub.