Build python 3.6 based on alpine
Talk is cheap
Files:
1 2 3 4
| > tree . ├── Dockerfile └── Python-3.6.10.tar.xz
|
1. Preparation
- Make a new dir for your work
1 2
| mkdir alpine_python3.6.10 cd alpine_python3.6.10
|
- Download python souce code tar-ball.
1
| wget 'https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tar.xz'
|
- cp & past
Dockerfile
below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| FROM alpine:latest AS alpine_py3.6
COPY ./Python-3.6.10.tar.xz /root WORKDIR /root
RUN \ sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ && echo "ipv6" >> /etc/modules RUN \ apk update \ && apk upgrade \ && apk add --no-cache bash gcc libffi-dev python-dev openssl-dev make zlib-dev libc-dev bash-doc bash-completion \ && rm -rf /var/cache/apk/* \ && tar -xf Python-3.6.10.tar.xz \ && rm -rf Python-3.6.10.tar.xz \ && cd Python-3.6.10 \ && ./configure --enable-optimizations \ && make -j 8 \ && make install \ && pip3 install --upgrade pip \ && rm -rf /root/Python-3.6.10 CMD /bin/sh
|
2. Build image
1
| docker build -t alpine:python3.6.10 .
|
3. Play with your new alpine:python3.6.10
1
| docker run -itd alpine:python3.6.10
|
EOF
Enjoy
I, simon love this world ❤️
感谢鼓励