2017-06-24 16:35:04 +08:00
|
|
|
# Dockerfile by xianhu: build a docker image for spider or flask
|
2018-04-15 11:12:15 +08:00
|
|
|
# usage: docker build -t user/centos:v15 .
|
2017-06-24 16:35:04 +08:00
|
|
|
|
|
|
|
FROM centos:6.8
|
|
|
|
|
|
|
|
MAINTAINER xianhu <qixianhu@qq.com>
|
|
|
|
|
|
|
|
# change system environments
|
|
|
|
ENV LANG en_US.UTF-8
|
|
|
|
ENV LC_ALL en_US.UTF-8
|
|
|
|
|
|
|
|
# change system local time
|
|
|
|
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
|
|
|
|
2017-11-17 22:26:55 +08:00
|
|
|
# fix: warning: rpmts_HdrFromFdno
|
2017-11-18 19:02:59 +08:00
|
|
|
RUN rpm --import /etc/pki/rpm-gpg/RPM*
|
2017-11-17 22:26:55 +08:00
|
|
|
|
2017-06-24 16:35:04 +08:00
|
|
|
# update yum and install something
|
|
|
|
RUN yum update -y
|
|
|
|
RUN yum install -y xz
|
|
|
|
RUN yum install -y vim
|
|
|
|
RUN yum install -y git
|
|
|
|
RUN yum install -y gcc
|
|
|
|
RUN yum install -y make
|
2017-10-17 10:18:24 +08:00
|
|
|
RUN yum install -y wget
|
|
|
|
RUN yum install -y screen
|
|
|
|
RUN yum install -y crontabs
|
2017-06-24 16:35:04 +08:00
|
|
|
RUN yum install -y zlib-devel
|
2017-11-17 18:35:59 +08:00
|
|
|
RUN yum install -y sqlite-devel
|
2017-06-24 16:35:04 +08:00
|
|
|
RUN yum install -y openssl-devel
|
2017-08-21 17:43:05 +08:00
|
|
|
|
|
|
|
# install nginx
|
|
|
|
ADD ./nginx.repo /etc/yum.repos.d/
|
|
|
|
RUN yum install -y nginx
|
|
|
|
|
|
|
|
# clean yum cache
|
2017-06-24 16:35:04 +08:00
|
|
|
RUN yum clean all
|
|
|
|
|
|
|
|
# restart crontab service
|
|
|
|
RUN service crond restart
|
|
|
|
|
|
|
|
# download python3
|
|
|
|
WORKDIR /root/
|
2018-04-15 11:12:15 +08:00
|
|
|
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
|
2017-06-24 16:35:04 +08:00
|
|
|
|
|
|
|
# install python3
|
2018-04-15 11:12:15 +08:00
|
|
|
WORKDIR /root/Python-3.6.5
|
2017-06-24 16:35:04 +08:00
|
|
|
RUN ./configure
|
|
|
|
RUN make install
|
|
|
|
RUN make clean
|
|
|
|
RUN make distclean
|
|
|
|
|
|
|
|
# install libs of python3
|
2017-08-21 17:43:05 +08:00
|
|
|
ADD ./requirements.txt /root/
|
2017-06-24 16:35:04 +08:00
|
|
|
WORKDIR /root/
|
|
|
|
RUN pip3 install --upgrade pip
|
2017-08-21 18:53:40 +08:00
|
|
|
RUN pip3 install -r requirements.txt
|
2017-07-12 09:55:39 +08:00
|
|
|
|
|
|
|
# clean everything
|
2017-06-24 16:35:04 +08:00
|
|
|
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
|