Skip to content

Commit 1f2a138

Browse files
committed
feat: enhance Docker build process and update Python environment variables
- Updated GitHub Actions workflow to utilize Docker Buildx for improved image building with caching support. - Refactored Dockerfiles for Python versions 3.10 to 3.15 to restore environment variables for Python version, pip, and setuptools. - Improved the extraction process in the packing_release_tar.sh script for better handling of Docker save outputs.
1 parent 2e94d0b commit 1f2a138

14 files changed

Lines changed: 131 additions & 113 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,20 @@ jobs: {
2222
"uses": "actions/checkout@v4",
2323
},
2424
{
25-
"name": "Build docker image",
26-
"run": "docker build -f ./${{ matrix.version }}/${{ matrix.architecture }}/Dockerfile -t release-${{ github.ref_name }}:${{ matrix.version }}-${{ matrix.architecture }} .",
25+
"name": "Set up Docker Buildx",
26+
"uses": "docker/setup-buildx-action@v3",
27+
},
28+
{
29+
"name": "Build docker image (with GHA layer cache)",
30+
"uses": "docker/build-push-action@v6",
31+
"with": {
32+
"context": ".",
33+
"file": "./${{ matrix.version }}/${{ matrix.architecture }}/Dockerfile",
34+
"tags": "release-${{ github.ref_name }}:${{ matrix.version }}-${{ matrix.architecture }}",
35+
"load": true,
36+
"cache-from": "type=gha,scope=deplibs-${{ matrix.architecture }}",
37+
"cache-to": "type=gha,mode=max,scope=deplibs-${{ matrix.architecture }}",
38+
},
2739
},
2840
{
2941
"name": "pip version",

3.10/x86/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM --platform=linux/386 alpine:3.22 AS base_builder
22

33
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
44
LANG=C.UTF-8 \
5-
PYTHON_VERSION=3.10.20 \
65
IS_32BIT=1 \
76
ZLIB_VERSION=1.3.2 \
87
FFI_VERSION=3.5.2 \
@@ -19,10 +18,7 @@ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
1918
UUID_VERSION=2.40.4 \
2019
SQLITE_VERSION=3530000 \
2120
SQLITE_VERSION_LITERIAL=3.53.0 \
22-
SQLITE_YEAR=2026 \
23-
PYTHON_PIP_VERSION=26.0.1 \
24-
PYTHON_SETUPTOOLS_VERSION=82.0.1
25-
21+
SQLITE_YEAR=2026
2622
WORKDIR /src
2723
RUN set -eux && apk add --no-cache ca-certificates tzdata && \
2824
apk add --no-cache --virtual .build-deps tar xz bluez-dev dpkg-dev dpkg findutils gcc file g++ \
@@ -114,6 +110,9 @@ RUN set -eux && ./build_sqlite3.sh
114110

115111
# =========== Python ===========
116112
FROM sqlite3_builder AS python_builder
113+
ENV PYTHON_VERSION=3.10.20 \
114+
PYTHON_PIP_VERSION=26.0.1 \
115+
PYTHON_SETUPTOOLS_VERSION=82.0.1
117116

118117
COPY ["common/build/deplib/build_python.sh", "common/build/deplib/install_pip.sh", "."]
119118
RUN set -eux && ./build_python.sh && ./install_pip.sh

3.10/x86_64/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM --platform=linux/amd64 alpine:3.22 AS base_builder
22

33
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
44
LANG=C.UTF-8 \
5-
PYTHON_VERSION=3.10.20 \
65
IS_32BIT=0 \
76
ZLIB_VERSION=1.3.2 \
87
FFI_VERSION=3.5.2 \
@@ -19,10 +18,7 @@ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
1918
UUID_VERSION=2.40.4 \
2019
SQLITE_VERSION=3530000 \
2120
SQLITE_VERSION_LITERIAL=3.53.0 \
22-
SQLITE_YEAR=2026 \
23-
PYTHON_PIP_VERSION=26.0.1 \
24-
PYTHON_SETUPTOOLS_VERSION=82.0.1
25-
21+
SQLITE_YEAR=2026
2622
WORKDIR /src
2723
RUN set -eux && apk add --no-cache ca-certificates tzdata && \
2824
apk add --no-cache --virtual .build-deps tar xz bluez-dev dpkg-dev dpkg findutils gcc file g++ \
@@ -114,6 +110,9 @@ RUN set -eux && ./build_sqlite3.sh
114110

115111
# =========== Python ===========
116112
FROM sqlite3_builder AS python_builder
113+
ENV PYTHON_VERSION=3.10.20 \
114+
PYTHON_PIP_VERSION=26.0.1 \
115+
PYTHON_SETUPTOOLS_VERSION=82.0.1
117116

118117
COPY ["common/build/deplib/build_python.sh", "common/build/deplib/install_pip.sh", "."]
119118
RUN set -eux && ./build_python.sh && ./install_pip.sh

3.11/x86/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM --platform=linux/386 alpine:3.22 AS base_builder
22

33
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
44
LANG=C.UTF-8 \
5-
PYTHON_VERSION=3.11.15 \
65
IS_32BIT=1 \
76
ZLIB_VERSION=1.3.2 \
87
FFI_VERSION=3.5.2 \
@@ -19,10 +18,7 @@ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
1918
UUID_VERSION=2.40.4 \
2019
SQLITE_VERSION=3530000 \
2120
SQLITE_VERSION_LITERIAL=3.53.0 \
22-
SQLITE_YEAR=2026 \
23-
PYTHON_PIP_VERSION=26.0.1 \
24-
PYTHON_SETUPTOOLS_VERSION=82.0.1
25-
21+
SQLITE_YEAR=2026
2622
WORKDIR /src
2723
RUN set -eux && apk add --no-cache ca-certificates tzdata && \
2824
apk add --no-cache --virtual .build-deps tar xz bluez-dev dpkg-dev dpkg findutils gcc file g++ \
@@ -114,6 +110,9 @@ RUN set -eux && ./build_sqlite3.sh
114110

115111
# =========== Python ===========
116112
FROM sqlite3_builder AS python_builder
113+
ENV PYTHON_VERSION=3.11.15 \
114+
PYTHON_PIP_VERSION=26.0.1 \
115+
PYTHON_SETUPTOOLS_VERSION=82.0.1
117116

118117
COPY ["common/build/deplib/build_python.sh", "common/build/deplib/install_pip.sh", "."]
119118
RUN set -eux && ./build_python.sh && ./install_pip.sh

3.11/x86_64/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM --platform=linux/amd64 alpine:3.22 AS base_builder
22

33
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
44
LANG=C.UTF-8 \
5-
PYTHON_VERSION=3.11.15 \
65
IS_32BIT=0 \
76
ZLIB_VERSION=1.3.2 \
87
FFI_VERSION=3.5.2 \
@@ -19,10 +18,7 @@ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
1918
UUID_VERSION=2.40.4 \
2019
SQLITE_VERSION=3530000 \
2120
SQLITE_VERSION_LITERIAL=3.53.0 \
22-
SQLITE_YEAR=2026 \
23-
PYTHON_PIP_VERSION=26.0.1 \
24-
PYTHON_SETUPTOOLS_VERSION=82.0.1
25-
21+
SQLITE_YEAR=2026
2622
WORKDIR /src
2723
RUN set -eux && apk add --no-cache ca-certificates tzdata && \
2824
apk add --no-cache --virtual .build-deps tar xz bluez-dev dpkg-dev dpkg findutils gcc file g++ \
@@ -114,6 +110,9 @@ RUN set -eux && ./build_sqlite3.sh
114110

115111
# =========== Python ===========
116112
FROM sqlite3_builder AS python_builder
113+
ENV PYTHON_VERSION=3.11.15 \
114+
PYTHON_PIP_VERSION=26.0.1 \
115+
PYTHON_SETUPTOOLS_VERSION=82.0.1
117116

118117
COPY ["common/build/deplib/build_python.sh", "common/build/deplib/install_pip.sh", "."]
119118
RUN set -eux && ./build_python.sh && ./install_pip.sh

3.12/x86/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM --platform=linux/386 alpine:3.22 AS base_builder
22

33
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
44
LANG=C.UTF-8 \
5-
PYTHON_VERSION=3.12.13 \
65
IS_32BIT=1 \
76
ZLIB_VERSION=1.3.2 \
87
FFI_VERSION=3.5.2 \
@@ -19,10 +18,7 @@ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
1918
UUID_VERSION=2.40.4 \
2019
SQLITE_VERSION=3530000 \
2120
SQLITE_VERSION_LITERIAL=3.53.0 \
22-
SQLITE_YEAR=2026 \
23-
PYTHON_PIP_VERSION=26.0.1 \
24-
PYTHON_SETUPTOOLS_VERSION=82.0.1
25-
21+
SQLITE_YEAR=2026
2622
WORKDIR /src
2723
RUN set -eux && apk add --no-cache ca-certificates tzdata && \
2824
apk add --no-cache --virtual .build-deps tar xz bluez-dev dpkg-dev dpkg findutils gcc file g++ \
@@ -114,6 +110,9 @@ RUN set -eux && ./build_sqlite3.sh
114110

115111
# =========== Python ===========
116112
FROM sqlite3_builder AS python_builder
113+
ENV PYTHON_VERSION=3.12.13 \
114+
PYTHON_PIP_VERSION=26.0.1 \
115+
PYTHON_SETUPTOOLS_VERSION=82.0.1
117116

118117
COPY ["common/build/deplib/build_python.sh", "common/build/deplib/install_pip.sh", "."]
119118
RUN set -eux && ./build_python.sh && ./install_pip.sh

3.12/x86_64/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM --platform=linux/amd64 alpine:3.22 AS base_builder
22

33
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
44
LANG=C.UTF-8 \
5-
PYTHON_VERSION=3.12.13 \
65
IS_32BIT=0 \
76
ZLIB_VERSION=1.3.2 \
87
FFI_VERSION=3.5.2 \
@@ -19,10 +18,7 @@ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
1918
UUID_VERSION=2.40.4 \
2019
SQLITE_VERSION=3530000 \
2120
SQLITE_VERSION_LITERIAL=3.53.0 \
22-
SQLITE_YEAR=2026 \
23-
PYTHON_PIP_VERSION=26.0.1 \
24-
PYTHON_SETUPTOOLS_VERSION=82.0.1
25-
21+
SQLITE_YEAR=2026
2622
WORKDIR /src
2723
RUN set -eux && apk add --no-cache ca-certificates tzdata && \
2824
apk add --no-cache --virtual .build-deps tar xz bluez-dev dpkg-dev dpkg findutils gcc file g++ \
@@ -114,6 +110,9 @@ RUN set -eux && ./build_sqlite3.sh
114110

115111
# =========== Python ===========
116112
FROM sqlite3_builder AS python_builder
113+
ENV PYTHON_VERSION=3.12.13 \
114+
PYTHON_PIP_VERSION=26.0.1 \
115+
PYTHON_SETUPTOOLS_VERSION=82.0.1
117116

118117
COPY ["common/build/deplib/build_python.sh", "common/build/deplib/install_pip.sh", "."]
119118
RUN set -eux && ./build_python.sh && ./install_pip.sh

3.13/x86/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM --platform=linux/386 alpine:3.22 AS base_builder
22

33
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
44
LANG=C.UTF-8 \
5-
PYTHON_VERSION=3.13.13 \
65
IS_32BIT=1 \
76
ZLIB_VERSION=1.3.2 \
87
FFI_VERSION=3.5.2 \
@@ -19,10 +18,7 @@ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
1918
UUID_VERSION=2.40.4 \
2019
SQLITE_VERSION=3530000 \
2120
SQLITE_VERSION_LITERIAL=3.53.0 \
22-
SQLITE_YEAR=2026 \
23-
PYTHON_PIP_VERSION=26.0.1 \
24-
PYTHON_SETUPTOOLS_VERSION=82.0.1
25-
21+
SQLITE_YEAR=2026
2622
WORKDIR /src
2723
RUN set -eux && apk add --no-cache ca-certificates tzdata && \
2824
apk add --no-cache --virtual .build-deps tar xz bluez-dev dpkg-dev dpkg findutils gcc file g++ \
@@ -114,6 +110,9 @@ RUN set -eux && ./build_sqlite3.sh
114110

115111
# =========== Python ===========
116112
FROM sqlite3_builder AS python_builder
113+
ENV PYTHON_VERSION=3.13.13 \
114+
PYTHON_PIP_VERSION=26.0.1 \
115+
PYTHON_SETUPTOOLS_VERSION=82.0.1
117116

118117
COPY ["common/build/deplib/build_python.sh", "common/build/deplib/install_pip.sh", "."]
119118
RUN set -eux && ./build_python.sh && ./install_pip.sh

3.13/x86_64/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM --platform=linux/amd64 alpine:3.22 AS base_builder
22

33
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
44
LANG=C.UTF-8 \
5-
PYTHON_VERSION=3.13.13 \
65
IS_32BIT=0 \
76
ZLIB_VERSION=1.3.2 \
87
FFI_VERSION=3.5.2 \
@@ -19,10 +18,7 @@ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
1918
UUID_VERSION=2.40.4 \
2019
SQLITE_VERSION=3530000 \
2120
SQLITE_VERSION_LITERIAL=3.53.0 \
22-
SQLITE_YEAR=2026 \
23-
PYTHON_PIP_VERSION=26.0.1 \
24-
PYTHON_SETUPTOOLS_VERSION=82.0.1
25-
21+
SQLITE_YEAR=2026
2622
WORKDIR /src
2723
RUN set -eux && apk add --no-cache ca-certificates tzdata && \
2824
apk add --no-cache --virtual .build-deps tar xz bluez-dev dpkg-dev dpkg findutils gcc file g++ \
@@ -114,6 +110,9 @@ RUN set -eux && ./build_sqlite3.sh
114110

115111
# =========== Python ===========
116112
FROM sqlite3_builder AS python_builder
113+
ENV PYTHON_VERSION=3.13.13 \
114+
PYTHON_PIP_VERSION=26.0.1 \
115+
PYTHON_SETUPTOOLS_VERSION=82.0.1
117116

118117
COPY ["common/build/deplib/build_python.sh", "common/build/deplib/install_pip.sh", "."]
119118
RUN set -eux && ./build_python.sh && ./install_pip.sh

3.14/x86/Dockerfile

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM --platform=linux/386 alpine:3.22 AS base_builder
22

33
ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
44
LANG=C.UTF-8 \
5-
PYTHON_VERSION=3.14.4 \
65
IS_32BIT=1 \
76
ZLIB_VERSION=1.3.2 \
87
FFI_VERSION=3.5.2 \
@@ -17,13 +16,9 @@ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
1716
XZ_VERSION=5.8.3 \
1817
BZIP2_VERSION=1.0.8 \
1918
UUID_VERSION=2.40.4 \
20-
ZSTD_VERSION=1.5.6 \
2119
SQLITE_VERSION=3530000 \
2220
SQLITE_VERSION_LITERIAL=3.53.0 \
23-
SQLITE_YEAR=2026 \
24-
PYTHON_PIP_VERSION=26.0.1 \
25-
PYTHON_SETUPTOOLS_VERSION=82.0.1
26-
21+
SQLITE_YEAR=2026
2722
WORKDIR /src
2823
RUN set -eux && apk add --no-cache ca-certificates tzdata && \
2924
apk add --no-cache --virtual .build-deps tar xz bluez-dev dpkg-dev dpkg findutils gcc file g++ \
@@ -103,13 +98,8 @@ FROM xz_builder AS bzip2_builder
10398
COPY ["common/build/deplib/build_bzip2.sh", "."]
10499
RUN set -eux && ./build_bzip2.sh
105100

106-
# =========== zstd ===========
107-
FROM bzip2_builder AS zstd_builder
108-
COPY ["common/build/deplib/build_zstd.sh", "."]
109-
RUN set -eux && ./build_zstd.sh
110-
111101
# =========== uuid ===========
112-
FROM zstd_builder AS uuid_builder
102+
FROM bzip2_builder AS uuid_builder
113103
COPY ["common/build/deplib/build_uuid.sh", "."]
114104
RUN set -eux && ./build_uuid.sh
115105

@@ -118,8 +108,17 @@ FROM uuid_builder AS sqlite3_builder
118108
COPY ["common/build/deplib/build_sqlite3.sh", "."]
119109
RUN set -eux && ./build_sqlite3.sh
120110

111+
# =========== zstd (after sqlite3 so 3.13's chain stays prefix-identical) ===========
112+
FROM sqlite3_builder AS zstd_builder
113+
ENV ZSTD_VERSION=1.5.6
114+
COPY ["common/build/deplib/build_zstd.sh", "."]
115+
RUN set -eux && ./build_zstd.sh
116+
121117
# =========== Python ===========
122-
FROM sqlite3_builder AS python_builder
118+
FROM zstd_builder AS python_builder
119+
ENV PYTHON_VERSION=3.14.4 \
120+
PYTHON_PIP_VERSION=26.0.1 \
121+
PYTHON_SETUPTOOLS_VERSION=82.0.1
123122

124123
COPY ["common/build/deplib/build_python.sh", "common/build/deplib/install_pip.sh", "."]
125124
RUN set -eux && ./build_python.sh && ./install_pip.sh

0 commit comments

Comments
 (0)