forked from Xilinx/Test_P
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.centos
51 lines (36 loc) · 2.04 KB
/
Dockerfile.centos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
ARG centosversion
FROM quay.io/centos/centos:centos${centosversion} AS builder
LABEL org.opencontainers.image.authors="[email protected]"
LABEL org.opencontainers.image.description="A containerized build of the latest versions of Python and OpenSSL."
ARG pythonversion
ARG opensslversion
RUN yum update -y \
&& yum install -y gcc gcc-c++ make \
bzip2-devel ncurses-devel gdbm-devel xz-devel redhat-lsb-core \
sqlite-devel libuuid-devel uuid-devel wget libcurl-devel \
perl zlib-devel libffi-devel readline-devel tcl-devel tk-devel \
&& yum clean all
ENV SSLDIR=/build/target/openssl-${opensslversion}
ENV PYTHONDIR=/build/target/python-${pythonversion}
ENV SSLDIR=/build/target/openssl-${opensslversion}
ENV LDFLAGS="-L${SSLDIR}/include -L/usr/include"
ENV CPPFLAGS="-I${SSLDIR}/include -I/usr/include -I/usr/lib/include"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DISTRO="$(/usr/bin/lsb_release -i | cut -d: -f2 | tr '[:upper:]' '[:lower:]')"
RUN mkdir /build
WORKDIR /build
RUN wget --progress=dot:giga https://www.openssl.org/source/openssl-${opensslversion}.tar.gz && tar -zxf openssl-${opensslversion}.tar.gz
RUN wget --progress=dot:giga https://www.python.org/ftp/python/${pythonversion}/Python-${pythonversion}.tgz && tar -zxf Python-${pythonversion}.tgz
WORKDIR /build/openssl-${opensslversion}
RUN ./Configure shared --prefix=${SSLDIR} --openssldir=${SSLDIR} linux-x86_64 && make -j8 && make install
WORKDIR /build/Python-${pythonversion}
RUN LDFLAGS="-L${SSLDIR}/include -L/usr/include" \
LD_LIBRARY_PATH="${SSLDIR}/lib:${SSLDIR}/lib64:/usr/lib64:/lib64" \
CPPFLAGS="-I${SSLDIR}/include -I${SSLDIR}/include/openssl -I/usr/include -I/usr/lib/include" \
./configure --prefix=${PYTHONDIR} --with-openssl=${SSLDIR} \
--with-openssl-rpath=auto \
--with-ensurepip=upgrade && make -j8 && make install
WORKDIR ${PYTHONDIR}/bin
RUN sed -i -e "s,${PYTHONDIR}/bin/python3*,/bin/env python3,g" 2to3* idle3* pip3* pydoc3*
FROM quay.io/centos/centos:centos${centosversion}
COPY --from=builder /build/target/ /package/