From efca15e9dbe18ad06b96cf3a546774ec3eeb11f9 Mon Sep 17 00:00:00 2001 From: xianhu Date: Wed, 23 May 2018 09:59:29 +0800 Subject: [PATCH] update dockerfile --- Docker/Dockerfile | 40 ++++++++++++---------------------------- Docker/nginx.repo | 2 +- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 9736f67..698a18a 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -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 # 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 diff --git a/Docker/nginx.repo b/Docker/nginx.repo index d11a88a..8603f5a 100644 --- a/Docker/nginx.repo +++ b/Docker/nginx.repo @@ -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