1- # Dockerfile by xianhu: build a docker image for spider or flask
2- # usage: docker build -t user/centos:v15 .
3-
4- FROM centos:6.8
1+ # Dockerfile by xianhu: build a docker image
2+ # usage: docker build -t user/centos:v16 .
53
4+ FROM centos:7
65MAINTAINER xianhu <qixianhu@qq.com>
76
87# change system environments
@@ -24,48 +23,33 @@ RUN yum install -y gcc
2423RUN yum install -y make
2524RUN yum install -y wget
2625RUN yum install -y screen
26+ RUN yum install -y gcc-c++
2727RUN yum install -y crontabs
2828RUN yum install -y zlib-devel
2929RUN yum install -y sqlite-devel
3030RUN yum install -y openssl-devel
3131
32+ # install python
33+ RUN yum -y install https://centos7.iuscommunity.org/ius-release.rpm
34+ RUN yum -y install python36u
35+ RUN yum -y install python36u-pip
36+ RUN yum -y install python36u-devel
37+
3238# install nginx
3339ADD ./nginx.repo /etc/yum.repos.d/
3440RUN yum install -y nginx
3541
3642# clean yum cache
3743RUN yum clean all
3844
39- # restart crontab service
40- RUN service crond restart
41-
42- # download python3
43- WORKDIR /root/
44- RUN wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
45- RUN tar -xf Python-3.6.5.tar.xz
46-
47- # install python3
48- WORKDIR /root/Python-3.6.5
49- RUN ./configure
50- RUN make install
51- RUN make clean
52- RUN make distclean
53-
5445# install libs of python3
5546ADD ./requirements.txt /root/
5647WORKDIR /root/
57- RUN pip3 install --upgrade pip
58- RUN pip3 install -r requirements.txt
48+ RUN pip3.6 install --upgrade pip
49+ RUN pip3.6 install -r requirements.txt
5950
6051# clean everything
6152RUN rm -rf /root/*
6253
63- # change python to python3
64- RUN ln -sf /usr/local/bin/python3 /usr/bin/python
65- RUN ln -sf /usr/bin/python2.6 /usr/bin/python2
66-
67- # change /usr/bin/yum
68- RUN sed -i 's/usr\/ bin\/ python/usr\/ bin\/ python2/g' /usr/bin/yum
69-
7054# cmd command
7155CMD /bin/bash
0 commit comments