Last active
June 26, 2023 00:23
-
-
Save AlmogCohen/e9e0667e875f955e0d4783b7433ed604 to your computer and use it in GitHub Desktop.
Dockerfile for Centos 6.10 with python 3.7 + pip + Pipenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################ | |
# Dockerfile to build CentOS linux server with python3.7 | |
# Can also use centos:6.9 as the origin dockerfile | |
############################################################ | |
FROM centos:6.10 | |
MAINTAINER Almog Cohen | |
# Install yum dependencies | |
RUN yum -y update && \ | |
yum groupinstall -y development && \ | |
yum install -y \ | |
bzip2-devel \ | |
git \ | |
hostname \ | |
openssl \ | |
openssl-devel \ | |
sqlite-devel \ | |
sudo \ | |
tar \ | |
wget \ | |
zlib-dev \ | |
libffi \ | |
libffi-devel | |
# SSL Fix https://benad.me/blog/2018/07/17/python-3.7-on-centos-6/ | |
RUN cd /tmp && \ | |
wget 'https://www.openssl.org/source/openssl-1.1.0h.tar.gz' &&\ | |
tar -xf openssl-1.1.0h.tar.gz &&\ | |
cd openssl-1.1.0h &&\ | |
./config shared --prefix=/usr/local/openssl11 --openssldir=/usr/local/openssl11 && make && make install | |
# End of SSL fix | |
# Install python3.7 | |
RUN cd /tmp && \ | |
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz && \ | |
tar xvfz Python-3.7.3.tgz && \ | |
cd Python-3.7.3 && \ | |
# Fix the SSL headers https://benad.me/blog/2018/07/17/python-3.7-on-centos-6/ | |
sed -i 's/SSL=\/usr\/local\/ssl/SSL=\/usr\/local\/openssl11/g' Modules/Setup.dist &&\ | |
sed -i '211,214 s/^##*//' Modules/Setup.dist &&\ | |
# End of SSL fix | |
LDFLAGS="-Wl,-rpath=/usr/local/openssl11/lib" \ | |
./configure --prefix=/usr/local --enable-shared --with-openssl=/usr/local/openssl11 --with-system-ffi && \ | |
make && \ | |
make altinstall | |
# Update libraries bindings | |
RUN echo "/usr/local/lib" >> /etc/ld.so.conf | |
RUN ldconfig | |
# Update the default pip version shipped with python | |
RUN pip3.7 install --upgrade pip | |
# Install Pipenv and add to path | |
RUN pip3.7 install pipenv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I needed to add
--no-check-certificate
to the wget on line 28