update dockerfile

master
xianhu 2018-05-23 09:59:29 +08:00
parent 688653828a
commit efca15e9db
2 changed files with 13 additions and 29 deletions

View File

@ -1,8 +1,7 @@
# Dockerfile by xianhu: build a docker image for spider or flask
# usage: docker build -t user/centos:v15 .
FROM centos:6.8
# Dockerfile by xianhu: build a docker image
# usage: docker build -t user/centos:v16 .
FROM centos:7
MAINTAINER xianhu <qixianhu@qq.com>
# change system environments
@ -24,11 +23,18 @@ RUN yum install -y gcc
RUN yum install -y make
RUN yum install -y wget
RUN yum install -y screen
RUN yum install -y gcc-c++
RUN yum install -y crontabs
RUN yum install -y zlib-devel
RUN yum install -y sqlite-devel
RUN yum install -y openssl-devel
# install python
RUN yum -y install https://centos7.iuscommunity.org/ius-release.rpm
RUN yum -y install python36u
RUN yum -y install python36u-pip
RUN yum -y install python36u-devel
# install nginx
ADD ./nginx.repo /etc/yum.repos.d/
RUN yum install -y nginx
@ -36,36 +42,14 @@ RUN yum install -y nginx
# clean yum cache
RUN yum clean all
# restart crontab service
RUN service crond restart
# download python3
WORKDIR /root/
RUN wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
RUN tar -xf Python-3.6.5.tar.xz
# install python3
WORKDIR /root/Python-3.6.5
RUN ./configure
RUN make install
RUN make clean
RUN make distclean
# install libs of python3
ADD ./requirements.txt /root/
WORKDIR /root/
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt
RUN pip3.6 install --upgrade pip
RUN pip3.6 install -r requirements.txt
# clean everything
RUN rm -rf /root/*
# change python to python3
RUN ln -sf /usr/local/bin/python3 /usr/bin/python
RUN ln -sf /usr/bin/python2.6 /usr/bin/python2
# change /usr/bin/yum
RUN sed -i 's/usr\/bin\/python/usr\/bin\/python2/g' /usr/bin/yum
# cmd command
CMD /bin/bash

View File

@ -1,5 +1,5 @@
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1