-
Notifications
You must be signed in to change notification settings - Fork 803
Use python:3-alpine instead of alpine:latest #9356
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
Use python:3-alpine instead of alpine:latest #9356
Conversation
this ensures we are using the latest stable Python version, which should avoid issues such as pgadmin-org#9155
WalkthroughThe Dockerfile base images were updated from alpine:latest to python:3-alpine for both the build and final stages. Python and pip dependencies were consolidated, libzstd references were removed, and the Python binary path was adjusted to accommodate the new base image structure. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting. Comment |
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Dockerfile (1)
71-90: Investigate and address sshtunnel SyntaxWarning before merging.The codebase includes
sshtunnel==0.*in requirements.txt, which locks to v0.4.0 (the latest release from January 2021). Python 3.14 surfaced a new SyntaxWarning in sshtunnel.py line 1040 regardingreturnin afinallyblock. This package is unmaintained and does not have a newer version that addresses this warning. Such constructs may become errors in future Python releases. Either upgrade to a maintained alternative, apply a patch, or filter the warning before merging.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Dockerfile(4 hunks)
🔇 Additional comments (1)
Dockerfile (1)
71-90: Base image upgrade looks sound.The switch from alpine:latest to python:3-alpine is correct—python3 and pip are already included, so their removal from explicit installation is appropriate. The venv creation with
--system-site-packages --without-pipfollowed by pip install should work correctly because the system Python's pip remains accessible via the venv's Python binary.
The
Already tested, built and run the container. Not to mention, we can see that it's what's used by the python Dockerfile.
|
|
Tip For best results, initiate chat on the files or code changes. @Guiorgy, thank you for the thorough clarifications! You're absolutely right on all points:
The changes look good, and it's clear you've thoroughly tested and verified them. Thank you for the detailed response and references! 🎉 ✏️ Learnings added
|
|
Huh, wouldn't expect a JavaScript test to fail on updating Python version. Is the test failing correctly? |
Out of 3, only one platform is failing for JavaScript. That can be ignored. |
|
Hi @Guiorgy, which ticket is associated with this PR? |
This ensures we are using the latest stable Python version, which should avoid issues such as #9155
Additional changes:
python3,py3-pipandpython3-dev, since they are now redundant, everything is already included.libzstd.so.1.5.7frompg18-builder, since it's already present./usr/bin/python3to/usr/local/bin/python3, since it's no longer installed from the Alpine repos.python:3-alpineimage uses the latest stable python version,/usr/local/bin/python3.[0-9][0-9]is used when setting capabilities, which automatically finds and matches the correct bindary.PS. Using Python 3.14 revealed a new warning:
/venv/lib/python3.14/site-packages/sshtunnel.py:1040: SyntaxWarning: 'return' in a 'finally' block😅Edit: It should be noted that the image size grew by ~19 MB:
Edit 2: Using this image in production with no issues so far.
Edit 3: It is possible to use a fixed major version (latest minor) of Python instead of the latest stable, e.g.
python:3.13-alpine, however, I am assuming a new version of the base application will not be released without support of the latest stable Python release, so this should be no issue for containers. If it is a concern, we can use a fixed point release, though, then maintainers will have to remember and decide when to manually bump it, increasing the burden.Summary by CodeRabbit