Skip to content

Commit 7065dd8

Browse files
committed
Revert "feat(python): switch to official builds for all"
This reverts commit 05fc3d8.
1 parent 05fc3d8 commit 7065dd8

File tree

4 files changed

+13
-180
lines changed

4 files changed

+13
-180
lines changed

python/3.10/Dockerfile

Lines changed: 0 additions & 44 deletions
This file was deleted.

python/3.11/Dockerfile

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,17 @@
11
# Python image for AMP containers using Python 3.11
22
# ghcr.io/cubecoders/amp:python-3.11
33

4-
FROM python:3.11-slim-bookworm AS py311
5-
6-
RUN set -eux; \
7-
V=3.11; \
8-
P=/usr/local/bin/python$V; \
9-
D=/usr/local/lib/python$V/lib-dynload; \
10-
{ ldd "$P"; find "$D" -type f -name '*.so' -print0 | xargs -0 -n1 ldd; } \
11-
| awk '/=> \//{print $(NF-1)} /^\//{print $1}' \
12-
| awk 'index($0,"/usr/local/")!=1 && $0 ~ "^/(usr/)?lib"' \
13-
| sed -E 's,^/(usr/)?,,g' | sort -u > /tmp/paths-$V.txt; \
14-
xargs -r dpkg-query --search < /tmp/paths-$V.txt \
15-
| awk -F: 'NF{print $1}' | sort -u > /tmp/deps-$V.txt; \
16-
echo "Runtime packages:" && cat /tmp/deps-$V.txt
17-
184
FROM ghcr.io/cubecoders/amp:debian
195
LABEL org.opencontainers.image.licenses=MIT
206

217
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
228

239
ARG DEBIAN_FRONTEND=noninteractive
2410

25-
COPY --from=py311 /tmp/deps-3.11.txt /deps/3.11.txt
26-
11+
# System Python (3.11) from Debian
2712
RUN set -eux; \
2813
apt-get update; \
29-
apt-get purge -y --auto-remove python3\*; \
30-
RUNTIME_DEPS="$(cat /deps/3.11.txt)"; \
31-
apt-get install -y --no-install-recommends $RUNTIME_DEPS; \
14+
apt-get install -y --no-install-recommends \
15+
python3.11 python3-pip python3.11-venv; \
3216
apt-get clean; \
33-
rm -rf /var/lib/apt/lists/*
34-
35-
COPY --from=py311 /usr/local/ /usr/local/
36-
37-
RUN set -eux; \
38-
for src in idle3 pip3 pydoc3 python3 python3-config; do \
39-
dst="$(echo "$src" | tr -d 3)"; \
40-
[ -e "/usr/local/bin/$dst" ] || ln -s "/usr/local/bin/$src" "/usr/local/bin/$dst"; \
41-
done; \
42-
for shim in python3.11 python3 pip3.11 pip3 pip; do \
43-
ln -sf "/usr/local/bin/$shim" "/usr/bin/$shim"; \
44-
done
17+
rm -rf /var/lib/apt/lists/*

python/3.12/Dockerfile

Lines changed: 0 additions & 44 deletions
This file was deleted.

python/3/Dockerfile

Lines changed: 9 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,21 @@
1-
# Python image for AMP containers including Python 3.10, 3.11 (default) and 3.12
1+
# Python image for AMP containers including Python 3.10, 3.11 and 3.12
22
# ghcr.io/cubecoders/amp:python-3
33

44
FROM python:3.10-slim-bookworm AS py310
5-
6-
RUN set -eux; \
7-
V=3.10; \
8-
P=/usr/local/bin/python$V; \
9-
D=/usr/local/lib/python$V/lib-dynload; \
10-
{ ldd "$P"; find "$D" -type f -name '*.so' -print0 | xargs -0 -n1 ldd; } \
11-
| awk '/=> \//{print $(NF-1)} /^\//{print $1}' \
12-
| awk 'index($0,"/usr/local/")!=1 && $0 ~ "^/(usr/)?lib"' \
13-
| sed -E 's,^/(usr/)?,,g' | sort -u > /tmp/paths-$V.txt; \
14-
xargs -r dpkg-query --search < /tmp/paths-$V.txt \
15-
| awk -F: 'NF{print $1}' | sort -u > /tmp/deps-$V.txt; \
16-
echo "Runtime packages:" && cat /tmp/deps-$V.txt
17-
18-
FROM python:3.11-slim-bookworm AS py311
19-
20-
RUN set -eux; \
21-
V=3.11; \
22-
P=/usr/local/bin/python$V; \
23-
D=/usr/local/lib/python$V/lib-dynload; \
24-
{ ldd "$P"; find "$D" -type f -name '*.so' -print0 | xargs -0 -n1 ldd; } \
25-
| awk '/=> \//{print $(NF-1)} /^\//{print $1}' \
26-
| awk 'index($0,"/usr/local/")!=1 && $0 ~ "^/(usr/)?lib"' \
27-
| sed -E 's,^/(usr/)?,,g' | sort -u > /tmp/paths-$V.txt; \
28-
xargs -r dpkg-query --search < /tmp/paths-$V.txt \
29-
| awk -F: 'NF{print $1}' | sort -u > /tmp/deps-$V.txt; \
30-
echo "Runtime packages:" && cat /tmp/deps-$V.txt
31-
325
FROM python:3.12-slim-bookworm AS py312
336

34-
RUN set -eux; \
35-
V=3.12; \
36-
P=/usr/local/bin/python$V; \
37-
D=/usr/local/lib/python$V/lib-dynload; \
38-
{ ldd "$P"; find "$D" -type f -name '*.so' -print0 | xargs -0 -n1 ldd; } \
39-
| awk '/=> \//{print $(NF-1)} /^\//{print $1}' \
40-
| awk 'index($0,"/usr/local/")!=1 && $0 ~ "^/(usr/)?lib"' \
41-
| sed -E 's,^/(usr/)?,,g' | sort -u > /tmp/paths-$V.txt; \
42-
xargs -r dpkg-query --search < /tmp/paths-$V.txt \
43-
| awk -F: 'NF{print $1}' | sort -u > /tmp/deps-$V.txt; \
44-
echo "Runtime packages:" && cat /tmp/deps-$V.txt
45-
467
FROM ghcr.io/cubecoders/amp:debian
478
LABEL org.opencontainers.image.licenses=MIT
489

4910
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
5011

5112
ARG DEBIAN_FRONTEND=noninteractive
5213

53-
COPY --from=py310 /tmp/deps-3.10.txt /deps/3.10.txt
54-
COPY --from=py311 /tmp/deps-3.11.txt /deps/3.11.txt
55-
COPY --from=py312 /tmp/deps-3.12.txt /deps/3.12.txt
56-
14+
# System Python (3.11) from Debian
5715
RUN set -eux; \
5816
apt-get update; \
59-
apt-get purge -y --auto-remove python3\*; \
60-
awk '{ if (!($0 in seen)) { print; seen[$0] } }' /deps/*.txt > /deps/all.txt; \
61-
sort -u -o /deps/all.txt /deps/all.txt; \
62-
xargs -r apt-get install -y --no-install-recommends < /deps/all.txt; \
17+
apt-get install -y --no-install-recommends \
18+
python3.11 python3-pip python3.11-venv; \
6319
apt-get clean; \
6420
rm -rf /var/lib/apt/lists/*
6521

@@ -71,16 +27,8 @@ COPY --from=py310 /usr/local/bin/ /usr/local/bin/
7127
COPY --from=py312 /usr/local/lib/ /usr/local/lib/
7228
COPY --from=py312 /usr/local/bin/ /usr/local/bin/
7329

74-
# Drop in Python 3.11
75-
COPY --from=py311 /usr/local/lib/ /usr/local/lib/
76-
COPY --from=py311 /usr/local/bin/ /usr/local/bin/
77-
78-
# Make explicit version shims available in /usr/bin, and make 3.11 default
79-
RUN set -eux; \
80-
for src in idle3 pip3 pydoc3 python3 python3-config; do \
81-
dst="$(echo "$src" | tr -d 3)"; \
82-
[ -e "/usr/local/bin/$dst" ] || ln -s "/usr/local/bin/$src" "/usr/local/bin/$dst"; \
83-
done; \
84-
for shim in python3.11 python3.10 python3.12 python3 pip3.11 pip3.10 pip3.12 pip3 pip; do \
85-
ln -sf "/usr/local/bin/$shim" "/usr/bin/$shim"; \
86-
done
30+
# Make explicit version shims available in /usr/bin
31+
RUN ln -sf /usr/local/bin/python3.10 /usr/bin/python3.10 && \
32+
ln -sf /usr/local/bin/python3.12 /usr/bin/python3.12 && \
33+
ln -sf /usr/local/bin/pip3.10 /usr/bin/pip3.10 && \
34+
ln -sf /usr/local/bin/pip3.12 /usr/bin/pip3.12

0 commit comments

Comments
 (0)