Skip to content

Instantly share code, notes, and snippets.

@cjjavellana
Created June 27, 2021 03:16
Show Gist options
  • Save cjjavellana/0b0bf0c3db5f2436a1119330cde85249 to your computer and use it in GitHub Desktop.
Save cjjavellana/0b0bf0c3db5f2436a1119330cde85249 to your computer and use it in GitHub Desktop.
Compile Python From Source for centos / rhel / fedora
FROM centos:latest
USER root
# We separate update as this step takes too long
RUN yum -y update
RUN yum -y groupinstall "Development Tools" && \
yum -y install gcc openssl-devel bzip2-devel libffi-devel && \
yum -y install wget
ENV PATH="/apps/Python-3.9.5/bin:${PATH}"
RUN mkdir /apps && \
cd /tmp && \
wget https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz && \
tar xzvf Python-3.9.5.tgz && \
cd /tmp/Python-3.9.5 && \
./configure --enable-optimizations --with-ensurepip=install --prefix=/apps/Python-3.9.5 && \
make && \
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment