增加 Docker GUI 支持
This commit is contained in:
parent
663f699537
commit
58d18133c7
64
docker/gui/Dockerfile
Normal file
64
docker/gui/Dockerfile
Normal file
@ -0,0 +1,64 @@
|
||||
FROM ubuntu:16.04
|
||||
LABEL name="vnpy"
|
||||
LABEL maintainer="joans321 <xjq9296@gmail.com>"
|
||||
|
||||
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 /
|
||||
|
51
docker/gui/README.md
Normal file
51
docker/gui/README.md
Normal file
@ -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/)
|
||||
|
||||
|
||||
|
||||
|
||||
|
4
docker/gui/build.sh
Executable file
4
docker/gui/build.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
docker build . -t vnpy
|
||||
|
||||
|
13
docker/gui/run.sh
Executable file
13
docker/gui/run.sh
Executable file
@ -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
|
||||
|
||||
|
@ -13,3 +13,7 @@ gevent-websocket
|
||||
pyjwt
|
||||
ccxt
|
||||
pyqtgraph
|
||||
qtpy
|
||||
psutil
|
||||
ta-lib
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user