Skip to content

Commit dcab444

Browse files
Bundle pyenv in the Docker image for on-demand Python versions (#225)
* Add pyenv to Docker image for on-demand Python versions Install pyenv (pinned to v2.7.1) just below uv, along with the Alpine build dependencies needed to compile CPython from source. This lets the bundled tooling build/install arbitrary Python versions on demand. Only the `pyenv` binary is symlinked onto the PATH; pyenv's shims directory is deliberately left off PATH so its shims don't shadow the system Python that the CLI runs on. bash is required since pyenv and the pyenv-installer are bash scripts. * Release 2.4.1: bundle pyenv in the Docker image Bump version to 2.4.1 and document the pyenv addition. The CLI is unchanged; this release exists to publish a Docker image that includes pyenv for on-demand Python version installation.
1 parent a486d4a commit dcab444

5 files changed

Lines changed: 36 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 2.4.1
4+
5+
### Added: pyenv in the Docker image
6+
7+
- The `socketdev/cli` Docker image now bundles [pyenv](https://github.com/pyenv/pyenv)
8+
(pinned to `v2.7.1`) along with the Alpine build dependencies needed to compile
9+
CPython from source, so the image can build/install arbitrary Python versions on
10+
demand.
11+
- The CLI itself is unchanged — this release only affects the published Docker image.
12+
313
## 2.4.0
414

515
### Changed: license details are no longer requested on the full-scan diff

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,29 @@ ENV GOPATH="/go"
8888
# Install uv
8989
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
9090

91+
# Install pyenv
92+
# pyenv lets us build/install arbitrary Python versions on demand. We install
93+
# the build dependencies needed to compile CPython on Alpine, then install
94+
# pyenv itself. We deliberately only symlink the `pyenv` binary onto the PATH
95+
# and do NOT add pyenv's shims directory, so its shims don't shadow the system
96+
# Python that the CLI runs on.
97+
RUN apk add --no-cache \
98+
bash \
99+
bzip2-dev \
100+
ca-certificates \
101+
libffi-dev \
102+
libxslt-dev \
103+
linux-headers \
104+
ncurses-dev \
105+
openssl-dev \
106+
readline-dev \
107+
sqlite-dev \
108+
xz-dev \
109+
zlib-dev
110+
RUN curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | PYENV_GIT_TAG="v2.7.1" bash && \
111+
ln -s ~/.pyenv/bin/pyenv /bin/pyenv && \
112+
pyenv --version
113+
91114
# Install CLI based on build mode
92115
RUN if [ "$USE_LOCAL_INSTALL" = "true" ]; then \
93116
echo "Using local development install"; \

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "socketsecurity"
9-
version = "2.4.0"
9+
version = "2.4.1"
1010
requires-python = ">= 3.11"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.4.0'
2+
__version__ = '2.4.1'
33
USER_AGENT = f'SocketPythonCLI/{__version__}'

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)