diff options
author | 2023-08-19 16:10:59 -0700 | |
---|---|---|
committer | 2023-08-19 20:42:56 -0700 | |
commit | 0db60fc25bb48d2c139b91e78b7bcfe7b98475b4 (patch) | |
tree | c7be500ffe0ca2a8acbd603395cb13fe331d39f2 /.github | |
parent | Use buildpack-deps as the builder base image (diff) |
Install multiple Python versions in 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.
Diffstat (limited to '.github')
-rw-r--r-- | .github/CONTRIBUTING.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d0a6921..1124b8e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -62,6 +62,14 @@ Updating NsJail mainly involves two steps: Other things to look out for are breaking changes to NsJail's config format, its command-line interface, or its logging format. Additionally, dependencies may have to be adjusted in the Dockerfile to get a new version to build or run. +## Adding and Updating Python Interpreters + +Python interpreters are built using pyenv via the `scripts/build_python.sh` helper script. This script accepts a pyenv version specifier (`pyenv install --list`) and builds the interpreter in a version-specific directory under `/lang/python`. In the image, each minor version of a Python interpreter should have its own build stage and the resulting `/lang/python` directory can be copied from that stage into the `base` stage. + +When updating a patch version (e.g. 3.11.3 to 3.11.4), edit the existing build stage in the image for the minor version (3.11); do not add a new build stage. To have access to a new version, pyenv likely needs to be updated. To do so, change the tag in the `git clone` command in the image, but only for the build stage that needs access to the new version. Updating pyenv for all build stages will just cause unnecessary build cache invalidations. + +To change the default interpreter used by NsJail, update the target of the `/lang/python/default` symlink created in the `base` stage. + [readme]: ../README.md [Dockerfile]: ../Dockerfile [Compose v2]: https://docs.docker.com/compose/compose-v2/ |