Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

fix(docker): run boto3 on Python 3.12 in the compat image (#5649)

Yuichiro Yamashita9e6be8ff21c1
diff --git a/docker/Dockerfile.compat b/docker/Dockerfile.compat
index 3819bffa93..104a2ce327 100644
--- a/docker/Dockerfile.compat
+++ b/docker/Dockerfile.compat
@@ -52,8 +52,13 @@ ENV AWS_PAGER=""
# a v2 install against real AWS. A hook passing raw bytes (e.g.
# aws lambda invoke --payload) needs --cli-binary-format raw-in-base64-out.
ARG AWSCLI_VERSION=2.36.24
+# Not the platform python3 (3.9): botocore 1.43+ needs 3.10, and on 3.9 it pins urllib3 to 1.26.
+# The python3, python, pip3 and pip links keep hooks that call them by name or path working.
+ARG PYTHON=python3.12
RUN useradd -r -u 1001 -g root -d /app -s /sbin/nologin floci \
- && microdnf install -y --nodocs python3 python3-pip unzip \
+ && microdnf install -y --nodocs ${PYTHON} ${PYTHON}-pip unzip \
+ && for name in python3 python; do ln -s ${PYTHON} /usr/bin/${name}; done \
+ && for name in pip3 pip; do ln -s pip${PYTHON#python} /usr/bin/${name}; done \
&& pip3 install --no-cache-dir boto3 \
&& case "$(uname -m)" in \
x86_64) arch=x86_64 ;; \
@@ -72,8 +77,8 @@ RUN useradd -r -u 1001 -g root -d /app -s /sbin/nologin floci \
# The system Python keeps pip, setuptools and what boto3 imports; the optimised .pyc
# variants, lib2to3 and ensurepip (pip is already installed) are build-time extras.
&& rm -rf /usr/local/aws-cli/v2/*/dist/awscli/data/ac.index /usr/local/aws-cli/v2/*/dist/aws_completer /usr/bin/aws_completer \
- && rm -rf /usr/lib64/python3.9/lib2to3 /usr/lib64/python3.9/ensurepip \
- && python3 -c 'import pathlib; [p.unlink() for d in ("/usr/lib64/python3.9","/usr/lib/python3.9") for p in pathlib.Path(d).rglob("*.opt-[12].pyc")]' \
+ && rm -rf /usr/lib64/${PYTHON}/lib2to3 /usr/lib64/${PYTHON}/ensurepip \
+ && python3 -c 'import pathlib, sys; [p.unlink() for d in ("/usr/lib64/" + sys.argv[1], "/usr/lib/" + sys.argv[1]) for p in pathlib.Path(d).rglob("*.opt-[12].pyc")]' "${PYTHON}" \
&& microdnf remove -y unzip \
&& microdnf clean all \
&& rm -rf /root/.cache/pip
diff --git a/docs/configuration/docker-images.md b/docs/configuration/docker-images.md
index 7fb896c40a..9afdb3b8ac 100644
--- a/docs/configuration/docker-images.md
+++ b/docs/configuration/docker-images.md
@@ -10,7 +10,7 @@ Every image tag combines two independent choices: **what's inside** (variant) an
|---|---|---|
| **Standard** | Floci native binary only | General use: CI, local dev, Testcontainers **(recommended)** |
| **Baseline** | Floci native binary compiled for ARMv8.0 (`armv8-a`) | ARM64 hosts without LSE, including Raspberry Pi 4-class CPUs |
-| **Compat** | Floci + Python 3 + AWS CLI + boto3 | Workflows that need AWS tooling available inside the container |
+| **Compat** | Floci + Python 3.12 + AWS CLI + boto3 | Workflows that need AWS tooling available inside the container |
The compat image runs the same native binary as the standard image, so startup time and memory footprint are identical. Only the image size increases. The baseline image is different: it is an ARM64-only release artifact compiled for the ARMv8.0 ISA floor and is not published on nightly channels.
@@ -174,7 +174,7 @@ ghcr.io/example/floci@sha256:...
The compat image adds the following to the standard image contents:
-- Python 3 + pip
+- Python 3.12 + pip (`python3`, `python`, `pip3` and `pip` all point at 3.12)
- [AWS CLI](https://pypi.org/project/awscli/) (via pip)
- [boto3](https://pypi.org/project/boto3/) (via pip)