Skip to content

Commit 746f001

Browse files
committed
update
1 parent 4ade290 commit 746f001

6 files changed

Lines changed: 48 additions & 564 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ jobs:
4141
with:
4242
username: ${{ secrets.DOCKER_HUB_USERNAME }}
4343
password: ${{ secrets.DOCKER_HUB_TOKEN }}
44+
- name: Copy files
45+
run: |
46+
cp -rf files/* ${{ matrix.major }}/${{ matrix.os }}/
47+
tree .
4448
- name: Build and push
4549
uses: docker/build-push-action@v5
4650
with:

3.11/alpine/Dockerfile

Lines changed: 5 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -4,138 +4,9 @@
44
#--------------------------------------------------------------------------
55
#
66

7-
FROM alpine:3.21
7+
ARG PYTHON_VERSION=3.11.12
8+
FROM python:${PYTHON_VERSION}-alpine
9+
LABEL maintainer="chinayin <whereismoney@qq.com>"
10+
ENV DEBIAN_FRONTEND=noninteractive
811

9-
# ensure local python is preferred over distribution python
10-
ENV PATH /usr/local/bin:$PATH
11-
12-
# cannot remove LANG even though https://bugs.python.org/issue19846 is fixed
13-
# last attempted removal of LANG broke many users:
14-
# https://github.com/docker-library/python/pull/570
15-
ENV LANG C.UTF-8
16-
17-
# runtime dependencies
18-
RUN set -eux; \
19-
apk add --no-cache \
20-
ca-certificates \
21-
tzdata \
22-
;
23-
24-
ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D
25-
ENV PYTHON_VERSION 3.11.12
26-
ENV PYTHON_SHA256 849da87af4df137710c1796e276a955f7a85c9f971081067c8f565d15c352a09
27-
28-
RUN set -eux; \
29-
\
30-
apk add --no-cache --virtual .build-deps \
31-
gnupg \
32-
tar \
33-
xz \
34-
\
35-
bluez-dev \
36-
bzip2-dev \
37-
dpkg-dev dpkg \
38-
findutils \
39-
gcc \
40-
gdbm-dev \
41-
libc-dev \
42-
libffi-dev \
43-
libnsl-dev \
44-
libtirpc-dev \
45-
linux-headers \
46-
make \
47-
ncurses-dev \
48-
openssl-dev \
49-
pax-utils \
50-
readline-dev \
51-
sqlite-dev \
52-
tcl-dev \
53-
tk \
54-
tk-dev \
55-
util-linux-dev \
56-
xz-dev \
57-
zlib-dev \
58-
; \
59-
\
60-
wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \
61-
echo "$PYTHON_SHA256 *python.tar.xz" | sha256sum -c -; \
62-
wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \
63-
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
64-
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \
65-
gpg --batch --verify python.tar.xz.asc python.tar.xz; \
66-
gpgconf --kill all; \
67-
rm -rf "$GNUPGHOME" python.tar.xz.asc; \
68-
mkdir -p /usr/src/python; \
69-
tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \
70-
rm python.tar.xz; \
71-
\
72-
cd /usr/src/python; \
73-
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
74-
./configure \
75-
--build="$gnuArch" \
76-
--enable-loadable-sqlite-extensions \
77-
--enable-option-checking=fatal \
78-
--enable-shared \
79-
--with-lto \
80-
--with-ensurepip \
81-
; \
82-
nproc="$(nproc)"; \
83-
# set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit()
84-
# https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
85-
EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \
86-
LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
87-
make -j "$nproc" \
88-
"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
89-
"LDFLAGS=${LDFLAGS:-}" \
90-
; \
91-
# https://github.com/docker-library/python/issues/784
92-
# prevent accidental usage of a system installed libpython of the same version
93-
rm python; \
94-
make -j "$nproc" \
95-
"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
96-
"LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \
97-
python \
98-
; \
99-
make install; \
100-
\
101-
cd /; \
102-
rm -rf /usr/src/python; \
103-
\
104-
find /usr/local -depth \
105-
\( \
106-
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
107-
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \
108-
\) -exec rm -rf '{}' + \
109-
; \
110-
\
111-
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \
112-
| tr ',' '\n' \
113-
| sort -u \
114-
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
115-
| xargs -rt apk add --no-network --virtual .python-rundeps \
116-
; \
117-
apk del --no-network .build-deps; \
118-
\
119-
export PYTHONDONTWRITEBYTECODE=1; \
120-
python3 --version; \
121-
\
122-
pip3 install \
123-
--disable-pip-version-check \
124-
--no-cache-dir \
125-
--no-compile \
126-
'setuptools==65.5.1' \
127-
# https://github.com/docker-library/python/issues/1023
128-
'wheel<0.46' \
129-
; \
130-
pip3 --version
131-
132-
# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends)
133-
RUN set -eux; \
134-
for src in idle3 pip3 pydoc3 python3 python3-config; do \
135-
dst="$(echo "$src" | tr -d 3)"; \
136-
[ -s "/usr/local/bin/$src" ]; \
137-
[ ! -e "/usr/local/bin/$dst" ]; \
138-
ln -svT "$src" "/usr/local/bin/$dst"; \
139-
done
140-
141-
CMD ["python3"]
12+
COPY prebuildfs /

3.11/debian/Dockerfile

Lines changed: 5 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -4,143 +4,9 @@
44
#--------------------------------------------------------------------------
55
#
66

7-
FROM chinayin/debian:bookworm-slim
7+
ARG PYTHON_VERSION=3.11.12
8+
FROM python:${PYTHON_VERSION}-slim
9+
LABEL maintainer="chinayin <whereismoney@qq.com>"
10+
ENV DEBIAN_FRONTEND=noninteractive
811

9-
# ensure local python is preferred over distribution python
10-
ENV PATH /usr/local/bin:$PATH
11-
12-
# cannot remove LANG even though https://bugs.python.org/issue19846 is fixed
13-
# last attempted removal of LANG broke many users:
14-
# https://github.com/docker-library/python/pull/570
15-
ENV LANG C.UTF-8
16-
17-
# runtime dependencies
18-
RUN set -eux; \
19-
apt-get update; \
20-
apt-get install -y --no-install-recommends \
21-
ca-certificates \
22-
netbase \
23-
tzdata \
24-
; \
25-
rm -rf /var/lib/apt/lists/*
26-
27-
ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D
28-
ENV PYTHON_VERSION 3.11.12
29-
ENV PYTHON_SHA256 849da87af4df137710c1796e276a955f7a85c9f971081067c8f565d15c352a09
30-
31-
RUN set -eux; \
32-
\
33-
savedAptMark="$(apt-mark showmanual)"; \
34-
apt-get update; \
35-
apt-get install -y --no-install-recommends \
36-
dpkg-dev \
37-
gcc \
38-
gnupg \
39-
libbluetooth-dev \
40-
libbz2-dev \
41-
libc6-dev \
42-
libdb-dev \
43-
libffi-dev \
44-
libgdbm-dev \
45-
liblzma-dev \
46-
libncursesw5-dev \
47-
libreadline-dev \
48-
libsqlite3-dev \
49-
libssl-dev \
50-
make \
51-
tk-dev \
52-
uuid-dev \
53-
wget \
54-
xz-utils \
55-
zlib1g-dev \
56-
; \
57-
\
58-
wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \
59-
echo "$PYTHON_SHA256 *python.tar.xz" | sha256sum -c -; \
60-
wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \
61-
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
62-
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \
63-
gpg --batch --verify python.tar.xz.asc python.tar.xz; \
64-
gpgconf --kill all; \
65-
rm -rf "$GNUPGHOME" python.tar.xz.asc; \
66-
mkdir -p /usr/src/python; \
67-
tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \
68-
rm python.tar.xz; \
69-
\
70-
cd /usr/src/python; \
71-
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
72-
./configure \
73-
--build="$gnuArch" \
74-
--enable-loadable-sqlite-extensions \
75-
--enable-optimizations \
76-
--enable-option-checking=fatal \
77-
--enable-shared \
78-
--with-lto \
79-
--with-ensurepip \
80-
; \
81-
nproc="$(nproc)"; \
82-
EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
83-
LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
84-
LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
85-
make -j "$nproc" \
86-
"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
87-
"LDFLAGS=${LDFLAGS:-}" \
88-
; \
89-
# https://github.com/docker-library/python/issues/784
90-
# prevent accidental usage of a system installed libpython of the same version
91-
rm python; \
92-
make -j "$nproc" \
93-
"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
94-
"LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \
95-
python \
96-
; \
97-
make install; \
98-
\
99-
cd /; \
100-
rm -rf /usr/src/python; \
101-
\
102-
find /usr/local -depth \
103-
\( \
104-
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
105-
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \
106-
\) -exec rm -rf '{}' + \
107-
; \
108-
\
109-
ldconfig; \
110-
\
111-
apt-mark auto '.*' > /dev/null; \
112-
apt-mark manual $savedAptMark; \
113-
find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \
114-
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \
115-
| sort -u \
116-
| xargs -r dpkg-query --search \
117-
| cut -d: -f1 \
118-
| sort -u \
119-
| xargs -r apt-mark manual \
120-
; \
121-
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
122-
rm -rf /var/lib/apt/lists/*; \
123-
\
124-
export PYTHONDONTWRITEBYTECODE=1; \
125-
python3 --version; \
126-
\
127-
pip3 install \
128-
--disable-pip-version-check \
129-
--no-cache-dir \
130-
--no-compile \
131-
'setuptools==65.5.1' \
132-
# https://github.com/docker-library/python/issues/1023
133-
'wheel<0.46' \
134-
; \
135-
pip3 --version
136-
137-
# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends)
138-
RUN set -eux; \
139-
for src in idle3 pip3 pydoc3 python3 python3-config; do \
140-
dst="$(echo "$src" | tr -d 3)"; \
141-
[ -s "/usr/local/bin/$src" ]; \
142-
[ ! -e "/usr/local/bin/$dst" ]; \
143-
ln -svT "$src" "/usr/local/bin/$dst"; \
144-
done
145-
146-
CMD ["python3"]
12+
COPY prebuildfs /

0 commit comments

Comments
 (0)