Skip to content

Instantly share code, notes, and snippets.

@mark99i
Created February 3, 2024 23:59
Show Gist options
  • Save mark99i/9a75a45300ebe6de7a663ab445b453a1 to your computer and use it in GitHub Desktop.
Save mark99i/9a75a45300ebe6de7a663ab445b453a1 to your computer and use it in GitHub Desktop.
Building OpenSSL master with Python 3.12.1
FROM debian:sid as openssl
RUN apt update
RUN apt install git nano build-essential checkinstall zlib1g-dev -y
RUN mkdir /root/openssl
WORKDIR /root/openssl
RUN git clone git://git.openssl.org/openssl.git .
RUN ./config --prefix=/usr/local/custom-openssl --openssldir=/etc/ssl
RUN make -j1 depend
RUN make -j`nproc`
RUN make install_sw
FROM debian:sid as python
RUN apt update
RUN apt install git nano build-essential checkinstall zlib1g-dev pkg-config uuid-dev libreadline-dev libffi-dev -y
RUN mkdir /root/cpython
WORKDIR /root/cpython
RUN git clone https://github.com/python/cpython.git --branch 3.12 .
COPY --from=openssl /usr/local/custom-openssl /usr/local/custom-openssl
COPY --from=openssl /etc/ssl /etc/ssl
ENV LDFLAGS "-L/usr/local/custom-openssl/lib64"
RUN ./configure --with-openssl=/usr/local/custom-openssl --with-openssl-rpath=auto --prefix /usr/local/custom-python
RUN make -j`nproc`
RUN make install
FROM debian:sid as app
COPY --from=openssl /usr/local/custom-openssl /usr/local/custom-openssl
COPY --from=openssl /etc/ssl /etc/ssl
COPY --from=python /usr/local/custom-python /usr/local/custom-python
RUN cp -ar /usr/local/custom-openssl/lib64/ /usr/local/custom-openssl/lib
RUN mkdir /root/app
WORKDIR /root/app
# COPY ....
CMD ["/usr/local/custom-python/bin/python3", "-c", "import ssl; print(ssl.OPENSSL_VERSION)"]
# prints OpenSSL 3.3.0-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment