ubuntu@gcp-debian:~/buildpython $ cat Dockerfile
FROM buildpack-deps:bionic
RUN set -ex; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive \
wget "https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz" -O /root/Python-3.8.5.tar.xz; \
tar -axvf /root/Python-3.8.5.tar.xz -C /root/; \
cd /root/Python-3.8.5 && ./configure && make -j4 && make install; \
rm -rf /var/lib/apt/lists/*
CMD ["/bin/bash"]
ubuntu@gcp-debian:~/buildpython $ docker container run -it mypy
mypy mypy:v1.0
ubuntu@gcp-debian:~/buildpython $ docker container run -it mypy:v1.0
root@afc94dce2c59:/# cd
root@afc94dce2c59:~# python3
Python 3.8.5 (default, Aug 20 2020, 04:43:51)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>>
root@afc94dce2c59:~# pip3 install requests
Collecting requests
Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
|████████████████████████████████| 61 kB 418 kB/s
Collecting idna<3,>=2.5
Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
|████████████████████████████████| 58 kB 4.5 MB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
|████████████████████████████████| 127 kB 17.8 MB/s
Collecting certifi>=2017.4.17
Downloading certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
|████████████████████████████████| 156 kB 22.9 MB/s
Collecting chardet<4,>=3.0.2
Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
|████████████████████████████████| 133 kB 24.5 MB/s
Installing collected packages: idna, urllib3, certifi, chardet, requests
Successfully installed certifi-2020.6.20 chardet-3.0.4 idna-2.10 requests-2.24.0 urllib3-1.25.10
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/usr/local/bin/python3.8 -m pip install --upgrade pip' command.
root@afc94dce2c59:~# exit
这里需要学习的知识点是在编译安装进行镜像构建时可以选择buildpack-deps为基础镜像进行安装