diff --git a/docker/gui/Dockerfile b/docker/gui/Dockerfile new file mode 100644 index 00000000..c530da42 --- /dev/null +++ b/docker/gui/Dockerfile @@ -0,0 +1,64 @@ +FROM ubuntu:16.04 +LABEL name="vnpy" +LABEL maintainer="joans321 " + +ARG user=vnpyuser +ARG group=vnpyuser +ARG uid=1000 +ARG gid=1000 +ARG ANACONDA=Anaconda2-4.0.0-Linux-x86_64.sh + + +ENV HOME /home/${user} +RUN groupadd -g ${gid} ${group} +RUN useradd -d $HOME -u ${uid} -g ${gid} -m -s /bin/bash ${user} + + +RUN apt-get update +RUN apt-get install -y gcc make cmake +RUN apt-get install -y build-essential +RUN apt-get install -y ccache +RUN apt-get install -y libssl-dev +RUN apt-get install -y wget curl git +RUN apt-get install -y gawk sed bison flex +RUN apt-get install -y bc libelf-dev +RUN apt-get install -y vim +RUN apt-get install -y net-tools gdb +RUN apt-get install -y iputils-ping +RUN apt-get install -y libncurses-dev +RUN apt-get install -y cpio +RUN apt-get install -y python-dev +RUN apt-get install -y mongodb +RUN apt-get install -y libboost-all-dev +RUN apt-get install -y libsnappy-dev python-snappy + +RUN apt-get install -y qt4-dev-tools +RUN apt-get install -y qtbase5-dev +RUN apt-get install -y python-pyqt5 +RUN apt-get install -y python3 +RUN apt-get install -y python3-pyqt5 +RUN apt-get install -y fonts-wqy-zenhei + + + +### Install Anaconda +RUN curl https://repo.continuum.io/archive/${ANACONDA} -o ${ANACONDA} && \ + /bin/bash ${ANACONDA} -b -p /opt/conda && \ + echo "export PATH=/opt/conda/bin:\$PATH" >> /etc/bash.bashrc && \ + rm ${ANACONDA} + +### Install ta-lib +RUN curl -L -O http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \ + tar -zxf ta-lib-0.4.0-src.tar.gz && \ + cd ta-lib && \ + ./configure --prefix=/usr && \ + make && make install + +RUN rm -rf /ta-lib-0.4.0-src.tar.gz /ta-lib + +RUN chown ${user} -R /opt + +ENV QT_X11_NO_MITSHM=1 + +WORKDIR / + diff --git a/docker/gui/README.md b/docker/gui/README.md new file mode 100644 index 00000000..349ebed2 --- /dev/null +++ b/docker/gui/README.md @@ -0,0 +1,51 @@ +# VNPY GUI Docker 镜像 + +该镜像提供编译及运行 vnpy 的环境。 + + + +# 编译镜像 + +~~~sh +$ docker build . -t vnpy +~~~ + + + +# 运行镜像 + +执行 [run.sh](./run.sh) 以 vnpyuser 用户启动容器并且把 vnpy 项目目录挂载到容器的 /srv/vnpy 目录。 + +~~~sh +$ ./run.sh +vnpyuser@e6ad42871a34$ cd /srv/vnpy +vnpyuser@e6ad42871a34:/srv/vnpy$ bash ./install.sh +vnpyuser@e6ad42871a34:/srv/vnpy$ cd examples/VnTrader/ +vnpyuser@4abb3834d129:/srv/vnpy/examples/VnTrader$ python run.py +~~~ + + + +# Mongodb 支持 + +// TODO : 数据保存到本地磁盘 + +* 容器内启动方法 + +~~~sh +$ docker exec -u 0 -it vnpy /bin/bash +$ mongod --smallfiles --config /etc/mongodb.conf +~~~ + + + +# OS X 支持 + +// TODO + +参考博客 : [docker-for-mac-and-gui-applications](https://fredrikaverpil.github.io/2016/07/31/docker-for-mac-and-gui-applications/) + + + + + diff --git a/docker/gui/build.sh b/docker/gui/build.sh new file mode 100755 index 00000000..570deccc --- /dev/null +++ b/docker/gui/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +docker build . -t vnpy + + diff --git a/docker/gui/run.sh b/docker/gui/run.sh new file mode 100755 index 00000000..2d893d1c --- /dev/null +++ b/docker/gui/run.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +THIS_DIR=$(cd `dirname $0`; pwd -P) +TOPDIR=${THIS_DIR}/../.. + +id=vnpyuser + +display="-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY" +volume="-v ${TOPDIR}:/srv/vnpy" + +docker run -it --rm --name vnpy -u $id $display $volume vnpy /bin/bash + + diff --git a/requirements.txt b/requirements.txt index 5b2fb05b..6751b70d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,3 +13,7 @@ gevent-websocket pyjwt ccxt pyqtgraph +qtpy +psutil +ta-lib +