FROM hub.c.163.com/public/ubuntu:16.04-tools #源镜像 MAINTAINER adam.ding , dxf813@126.com COPY requirements.txt /tmp/ #拷贝python须要安装文件 RUN apt-get update && apt-get -y install python3-pip libmysqlclient-dev python3-dev #python3-pip网易源没有 RUN echo "deb http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse" > /etc/apt/sources.list RUN apt-get update && apt-get install -y nginx redis-server git #下载一些基础服务 RUN mkdir /root/.pip #home目录 COPY pip.conf /root/.pip #拷贝更改的源配置文件 RUN pip3 install --upgrade pip RUN pip3 install matplotlib #此处不能放入requirement 必须分别安装 RUN pip3 install numpy COPY nginx-start.conf /etc/supervisor/conf.d #拷贝nginx配置文件 RUN pip3 install pandas==0.17.1 RUN pip3 install zipline==1.0.2 COPY uwsgi.ini /usr/local/etc/#拷贝uwsgi配置文件 RUN pip3 install uwsgi COPY vue-dist /usr/local/src/dzh/#将打包好的vue项目文件夹拷贝到指定目录 RUN pip3 install --requirement /tmp/requirements.txt RUN mkdir /usr/local/src/dzh WORKDIR /usr/local/src/dzh #切换到目录 RUN git clone https://username:pad@xx.com/xx.git WORKDIR /usr/local/src/dzh/squant_tools RUN python3 setup.py build_ext --inplace#安装系统 WORKDIR /etc/nginx/sites-enabled/ RUN mv default default.bb #将默认读取配置文件更名 COPY nginx.conf . WORKDIR /usr/local/src/dzh/simple_login RUN python3 setup.py install COPY squant_tools.conf /etc/supervisor/conf.d CMD supervisord /etc/supervisor/supervisord.conf
3,部分其余文件的配置vue
uwsgi.ini内容: [uwsgi] http-socket = :8000 plugin = python3 wsgi-file = /usr/local/src/dzh/squant_tools/quant/wsgi.py chdir= /usr/local/src/dzh/squant_tools module = quant.wsgi processes = 4 master=True vacuum=True 使用supervisor启动如下进程 squant_tools.conf内容: [program:squant_tools] command = uwsgi /usr/local/etc/uwsgi.ini stopsignal=KILL autostart=true autorestart=true stdout_logfile=/usr/local/etc/supervisor_stdout.log stderr_logfile=/usr/local/etc/supervisor_stderr.log redirect_stderr=true nginx-start.conf内容: [program:nginx] command = service nginx start process_name=%(program_name)s numprocs=4 ; 启动几个进程 autostart=true ; 随着supervisord的启动而启动 autorestart=true ; 自动重启。。固然要选上了 startretries=10 ; 启动失败时的最多重试次数 stopsignal=KILL ; 用来杀死进程的信号 stopwaitsecs=10 ; 发送SIGKILL前的等待时间 redirect_stderr=true ; 重定向stderr到stdout requirements.txt内容: django mysqlclient psycopg2 cython pymssql celery django-cors-headers click cn-stock-holidays redis zipline_cn_databundle