Skip to content

Commit af3f0f2

Browse files
authored
Merge pull request #25 from CubeCoders/python314
Add Python 3.14
2 parents 9f1c886 + ad5bb97 commit af3f0f2

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

.github/workflows/python.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
- '3.11'
5555
- '3.12'
5656
- '3.13'
57+
- '3.14'
5758

5859
steps:
5960
- uses: actions/checkout@v4

python/3.14/Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Python image for AMP containers using Python 3.14 from upstream
2+
# cubecoders/ampbase:python-3.14
3+
4+
FROM python:3.14-slim-trixie AS py314
5+
6+
ENV DEBIAN_FRONTEND="noninteractive"
7+
8+
ARG PYTHON_VERSION="3.14"
9+
10+
COPY scripts/python/find-deps.sh /usr/local/bin/find-deps.sh
11+
RUN chmod +x /usr/local/bin/find-deps.sh
12+
13+
RUN set -eux; \
14+
/usr/local/bin/find-deps.sh >/tmp/${PYTHON_VERSION}-run-deps.txt
15+
16+
FROM cubecoders/ampbase:debian
17+
LABEL org.opencontainers.image.licenses=MIT
18+
19+
ENV PIP_DISABLE_PIP_VERSION_CHECK="1"
20+
ENV AMP_ADDITIONAL_ENV_VARS="PIP_DISABLE_PIP_VERSION_CHECK"
21+
ENV DEBIAN_FRONTEND="noninteractive"
22+
23+
ARG PYTHON_VERSION="3.14"
24+
25+
# Drop in upstream Python 3.14
26+
COPY --from=py314 /usr/local/ /usr/local/
27+
28+
COPY --from=py314 /tmp/${PYTHON_VERSION}-run-deps.txt /tmp/${PYTHON_VERSION}-run-deps.txt
29+
30+
RUN set -eux; \
31+
apt-get update; \
32+
# Purge system Python binaries and libs
33+
PYTHON_PKGS="$(dpkg-query -W -f='${binary:Package}\n' \
34+
| awk '/^(python3($|[.:_-])|libpython3($|[.:_-]))/ {print}' \
35+
| sort -u)"; \
36+
printf '%s\n' "${PYTHON_PKGS}" | xargs -r apt-get purge --auto-remove -y; \
37+
\
38+
sort -u /tmp/${PYTHON_VERSION}-run-deps.txt \
39+
| awk 'NF && $1 !~ /^#/' \
40+
| xargs -r apt-get install -o APT::Keep-Downloaded-Packages="false" -y --no-install-recommends; \
41+
apt-get clean; \
42+
rm -rf /var/lib/apt/lists/* /tmp/${PYTHON_VERSION}-run-deps.txt; \
43+
\
44+
python${PYTHON_VERSION} -m pip install --no-cache-dir --upgrade pip setuptools wheel; \
45+
for shim in python python3 python${PYTHON_VERSION} pip pip3 pip${PYTHON_VERSION}; do \
46+
ln -sf "/usr/local/bin/${shim}" "/usr/bin/${shim}"; \
47+
done

python/3/Dockerfile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Python image for AMP containers including Python 3.10, 3.11, 3.12 and 3.13 (default) from upstream
1+
# Python image for AMP containers including Python 3.10, 3.11, 3.12, 3.13 (default) and 3.14 from upstream
22
# cubecoders/ampbase:python-3
33

44
FROM python:3.10-slim-trixie AS py310
@@ -37,6 +37,18 @@ RUN chmod +x /usr/local/bin/find-deps.sh
3737
RUN set -eux; \
3838
/usr/local/bin/find-deps.sh >/tmp/${PYTHON_VERSION}-run-deps.txt
3939

40+
FROM python:3.14-slim-trixie AS py314
41+
42+
ENV DEBIAN_FRONTEND="noninteractive"
43+
44+
ARG PYTHON_VERSION="3.14"
45+
46+
COPY scripts/python/find-deps.sh /usr/local/bin/find-deps.sh
47+
RUN chmod +x /usr/local/bin/find-deps.sh
48+
49+
RUN set -eux; \
50+
/usr/local/bin/find-deps.sh >/tmp/${PYTHON_VERSION}-run-deps.txt
51+
4052
FROM python:3.13-slim-trixie AS py313
4153

4254
ENV DEBIAN_FRONTEND="noninteractive"
@@ -57,7 +69,7 @@ ENV AMP_ADDITIONAL_ENV_VARS="PIP_DISABLE_PIP_VERSION_CHECK"
5769
ENV DEBIAN_FRONTEND="noninteractive"
5870

5971
ARG PYTHON_DEFAULT="3.13"
60-
ARG PYTHON_NON_DEFAULT="3.10 3.11 3.12"
72+
ARG PYTHON_NON_DEFAULT="3.10 3.11 3.12 3.14"
6173

6274
# Drop in upstream Python 3.10
6375
COPY --from=py310 /usr/local/ /usr/local/
@@ -74,6 +86,11 @@ COPY --from=py312 /usr/local/ /usr/local/
7486

7587
COPY --from=py312 /tmp/3.12-run-deps.txt /tmp/3.12-run-deps.txt
7688

89+
# Drop in upstream Python 3.14
90+
COPY --from=py314 /usr/local/ /usr/local/
91+
92+
COPY --from=py314 /tmp/3.14-run-deps.txt /tmp/3.14-run-deps.txt
93+
7794
# Drop in upstream Python 3.13 (default last)
7895
COPY --from=py313 /usr/local/ /usr/local/
7996

0 commit comments

Comments
 (0)