From 5585937470788da439186dc394d5f3dd677277d1 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Fri, 17 Nov 2023 02:00:36 -0800 Subject: [PATCH] add python package --- packages/python/Dockerfile | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 packages/python/Dockerfile diff --git a/packages/python/Dockerfile b/packages/python/Dockerfile new file mode 100644 index 0000000..342746f --- /dev/null +++ b/packages/python/Dockerfile @@ -0,0 +1,41 @@ +FROM imgrep/busybox:latest as busybox +FROM imgrep/gcc:latest as gcc +FROM imgrep/binutils:latest as binutils +FROM imgrep/musl:latest as musl +FROM imgrep/make:latest as make +FROM imgrep/openssl:latest as openssl + +FROM busybox as build +ENV SRC_SITE=https://www.python.org/ftp/python +ENV SRC_VERSION=3.12.0 +ENV SRC_HASH=795c34f44df45a0e9b9710c8c71c15c671871524cd412ca14def212e8ccb155d +RUN wget ${SRC_SITE}/${SRC_VERSION}/Python-${SRC_VERSION}.tar.xz +RUN echo "${SRC_HASH} Python-${SRC_VERSION}.tar.xz" | sha256sum -c +RUN tar -xf Python-${SRC_VERSION}.tar.xz +WORKDIR Python-${SRC_VERSION} +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=musl . / +COPY --from=openssl . / +RUN set -eux; \ + ./configure \ + --build="x86_64-linux-musl" \ + --host="x86_64-linux-musl" \ + --prefix=/usr \ + --enable-ipv6 \ + --enable-optimizations \ + --enable-shared \ + --with-lto \ + --with-computed-gotos \ + --without-ensurepip; \ + make; \ + make DESTDIR=/home/user/rootfs install +RUN ln -s /usr/bin/python3 /home/user/rootfs/usr/bin/python +COPY --from=musl . /home/user/rootfs/ + +FROM scratch +COPY --from=build /home/user/rootfs / +USER 100:100 +ENTRYPOINT ["/usr/bin/python"] +CMD ["--version"]