2024-02-09 07:30:28 +00:00
|
|
|
FROM scratch as base
|
|
|
|
ENV VERSION=3.12.0
|
2023-11-17 10:00:36 +00:00
|
|
|
ENV SRC_HASH=795c34f44df45a0e9b9710c8c71c15c671871524cd412ca14def212e8ccb155d
|
2024-02-09 07:30:28 +00:00
|
|
|
ENV SRC_FILE=Python-${VERSION}.tar.xz
|
2024-02-10 11:00:58 +00:00
|
|
|
ENV SRC_SITE=https://www.python.org/ftp/python/${VERSION}/${SRC_FILE}
|
2023-12-16 23:50:40 +00:00
|
|
|
|
|
|
|
FROM base as fetch
|
2024-02-10 10:57:34 +00:00
|
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
2023-12-16 23:50:40 +00:00
|
|
|
|
|
|
|
FROM fetch as build
|
2024-02-15 15:22:38 +00:00
|
|
|
COPY --from=stagex/busybox . /
|
|
|
|
COPY --from=stagex/gcc . /
|
|
|
|
COPY --from=stagex/binutils . /
|
|
|
|
COPY --from=stagex/make . /
|
|
|
|
COPY --from=stagex/musl . /
|
|
|
|
COPY --from=stagex/openssl . /
|
|
|
|
COPY --from=stagex/zlib . /
|
2024-02-09 07:30:28 +00:00
|
|
|
RUN tar -xf ${SRC_FILE}
|
|
|
|
WORKDIR Python-${VERSION}
|
2024-02-10 21:44:39 +00:00
|
|
|
ENV SOURCE_DATE_EPOCH=1
|
2024-01-30 07:54:54 +00:00
|
|
|
ENV PYTHONHASHSEED=0
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
2024-02-09 07:30:28 +00:00
|
|
|
RUN --network=none <<-EOF
|
|
|
|
set -eux
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
2023-11-17 10:00:36 +00:00
|
|
|
--enable-shared \
|
|
|
|
--with-computed-gotos \
|
2024-02-09 07:30:28 +00:00
|
|
|
--without-ensurepip
|
|
|
|
make
|
|
|
|
EOF
|
2023-12-16 23:50:40 +00:00
|
|
|
|
|
|
|
FROM build as install
|
2024-02-09 07:30:28 +00:00
|
|
|
RUN --network=none <<-EOF
|
|
|
|
set -eux
|
|
|
|
make DESTDIR=/rootfs install
|
|
|
|
ln -s /usr/bin/python3 /rootfs/usr/bin/python
|
|
|
|
EOF
|
2024-02-09 18:19:36 +00:00
|
|
|
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
2024-02-09 07:30:28 +00:00
|
|
|
|
|
|
|
FROM scratch as test
|
2024-03-01 18:30:23 +00:00
|
|
|
COPY --from=install /rootfs/. /
|
2024-02-15 15:22:38 +00:00
|
|
|
COPY --from=stagex/musl . /
|
2024-02-09 07:30:28 +00:00
|
|
|
COPY <<-EOF test.py
|
|
|
|
print("Success")
|
|
|
|
EOF
|
|
|
|
RUN python test.py | grep "Success"
|
2023-11-17 10:00:36 +00:00
|
|
|
|
2024-03-01 18:30:23 +00:00
|
|
|
FROM stagex/filesystem as package
|
|
|
|
COPY --from=install /rootfs/. /
|