Skip to content

Commit efca15e

Browse files
committed
update dockerfile
1 parent 6886538 commit efca15e

File tree

2 files changed

+13
-29
lines changed

2 files changed

+13
-29
lines changed

Docker/Dockerfile

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
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
65
MAINTAINER xianhu <qixianhu@qq.com>
76

87
# change system environments
@@ -24,48 +23,33 @@ RUN yum install -y gcc
2423
RUN yum install -y make
2524
RUN yum install -y wget
2625
RUN yum install -y screen
26+
RUN yum install -y gcc-c++
2727
RUN yum install -y crontabs
2828
RUN yum install -y zlib-devel
2929
RUN yum install -y sqlite-devel
3030
RUN 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
3339
ADD ./nginx.repo /etc/yum.repos.d/
3440
RUN yum install -y nginx
3541

3642
# clean yum cache
3743
RUN 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
5546
ADD ./requirements.txt /root/
5647
WORKDIR /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
6152
RUN 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
7155
CMD /bin/bash

Docker/nginx.repo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[nginx]
22
name=nginx repo
3-
baseurl=http://nginx.org/packages/centos/6/$basearch/
3+
baseurl=http://nginx.org/packages/centos/7/$basearch/
44
gpgcheck=0
55
enabled=1

0 commit comments

Comments
 (0)