Add Python 3.10.2 based on Ubuntu 20.04
[dockerfiles.git] / python-3.10.2 / Dockerfile
blob6d33c73cd89a67e93a6030ed1a71d9aed53bec8f
1 # DESCRIPTION:   Python 3.10.2 container
2 # AUTHOR:        https://github.com/r1w1s1
3 # COMMENTS:
4 #    Python 3.10.2 based on Ubuntu 20.04
6 # USAGE:
7 #    # Download Dockerfile
8 #    wget https://raw.githubusercontent.com/r1w1s1/dockerfiles/master/python-3.10.2/Dockerfile
10 #    # Build ruby image
11 #    docker build -t python-3.10.2-ubuntu:20.04 .
13 #    # Run the image
14 #    docker run -it python-3.10.2-ubuntu:20.04
17 FROM ubuntu:20.04 AS builder
19 ENV DEBIAN_FRONTEND=noninteractive
21 RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main" >> /etc/apt/sources.list \
22     && apt update \
23     && apt -y build-dep python3 \
24     && apt -y install curl gdb lcov libbz2-dev libffi-dev libgdbm-dev \
25        libgdbm-compat-dev liblzma-dev libncurses5-dev libreadline6-dev \
26        libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev \
27     && curl -o /root/Python-3.10.2.tgz https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz \
28     && cd /root \
29     && tar xzf Python-3.10.2.tgz \
30     && cd Python-3.10.2 \
31     && ./configure --enable-optimizations \
32     && make altinstall \
33     && ln -s /usr/local/bin/python3.10 /usr/bin \
34     && ln -s /usr/local/bin/pip3.10 /usr/bin
36 FROM ubuntu:20.04
38 COPY --from=builder /usr/local/ /usr/local/
40 RUN ln -s /usr/local/bin/python3.10 /usr/bin/python3 \
41     && ln -s /usr/local/bin/pip3.10 /usr/bin/pip3
43 CMD ["python3"]