-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Install Multiple Python Versions in the Image #181
Merged
Merged
Conversation
This file contains 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
It's using a stable version of Debian, so it's redundant to lock packages to specific versions.
Get some of the NsJail build dependencies pre-installed thanks to the base image.
Separate snekbox's Python interpreter from the interpreter used by NsJail. This allows for the interpreters to be updated on different cadences and provides better isolation of packages. Each Python interpreter adds about 70 MB to the built image.
Re-use already built COPY layers in subsequent builds even if the previous layers have changed, which is especially helpful when copying from another build stage. See https://docs.docker.com/engine/reference/builder/#copy---link
Prevent an empty exec_bin.args from manifesting as an empty string in the fully built arguments.
MarkKoz
added
type: feature
New feature or request
area: dependencies
Related to package dependencies and management
area: API
Related to or causes API changes
labels
Aug 20, 2023
Need to use `export` to set vars when && is used between the commands.
FWIW, I think this is a good approach as far as the image is concerned. |
MarkKoz
changed the title
Support Multiple Python Versions
Install Multiple Python Versions in the Image
Aug 26, 2023
ChrisLovering
approved these changes
Aug 26, 2023
jb3
previously requested changes
Aug 29, 2023
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.
all looks good and works locally -- just needs the --user
change for deps and should be good to go!
Due to the way that `find` executes -exec arguments we need to run the pip install's inside another `sh` instance so that the PYTHONUSERBASE environment variable is correctly picked up. Additionally, we need to specify `--user` so that pip respects the PYTHONUSERBASE variable at all.
jb3
dismissed
their stale review
August 29, 2023 18:02
Dismissing my review since I've added a commit to resolve comments
ChrisLovering
approved these changes
Aug 29, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: API
Related to or causes API changes
area: dependencies
Related to package dependencies and management
type: feature
New feature or request
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.
#158
This is an alternative implementation to #175
This just focuses on getting multiple Python interpreter versions into the image. There will be a follow-up PR with the API changes. The goal for the API is for users to be able to pass an arbitrary path to an executable binary (e.g. a path to a different Python interpreter).
See the changes in .github/CONTRIBUTING.md for an overview of how multiple Python versions are managed.
I observed smaller sizes (~70 MB) on Debian 12 (bookworm), but I've had trouble with test failures on bookworm, so the image remains on Debian 11 (buster) for now. About a third of the size seems to be occupied by the shared library.
If anyone knows of additional compiler flags or configuration options to bring down the size, please share!
Each Python interpreter build takes around 6 minutes, and that's with full optimisation enabled. Thankfully each build stage can run in parallel.