From 7453ad2dc12eb568ff4d9c56ebf0b41451035bf5 Mon Sep 17 00:00:00 2001 From: jaredbroad Date: Sun, 13 Nov 2016 00:29:19 -0500 Subject: [PATCH] Updated dockerfiles to include headless linux support for IB --- .dockerignore | 4 ++++ Dockerfile | 18 -------------- DockerfileLeanAlgorithm | 38 +++++++++++++++++++++++++++++ DockerfileLeanFoundation | 52 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 18 deletions(-) create mode 100644 .dockerignore delete mode 100644 Dockerfile create mode 100644 DockerfileLeanAlgorithm create mode 100644 DockerfileLeanFoundation diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000000..d2b08b1eda83 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +*/packages/* +*/.git/* +*/.vs/* +*/.nuget/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 7e6e65aa12b4..000000000000 --- a/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM mono:4.0.5.1 - -RUN mozroots --import --sync - -RUN mkdir -p /usr/src/app/source /usr/src/app/build -WORKDIR /usr/src/app/source - -COPY . /usr/src/app/source -RUN sed -i 's/4.5/4.0/' Algorithm.VisualBasic/QuantConnect.Algorithm.VisualBasic.vbproj -RUN nuget restore QuantConnect.Lean.sln -NonInteractive -RUN xbuild /property:Configuration=Release -WORKDIR /usr/src/app/source/Launcher/bin/Release/ - -CMD [ "mono", "./QuantConnect.Lean.Launcher.exe"] # Run app - -# usage: -# docker build -t lean . -# docker run lean diff --git a/DockerfileLeanAlgorithm b/DockerfileLeanAlgorithm new file mode 100644 index 000000000000..473f1b9c3af8 --- /dev/null +++ b/DockerfileLeanAlgorithm @@ -0,0 +1,38 @@ +# +# LEAN Algorithm Docker Container November-2016 +# Cross platform deployment for multiple brokerages +# + +FROM quantconnect/lean:foundation + +MAINTAINER QuantConnect + +################################# +# Option 1: Download from Master +# RUN \ +# wget https://github.com/QuantConnect/Lean/archive/master.zip && \ +# unzip master.zip ~/Lean && \ +# cd ~/Lean +# RUN \ +# sed -i 's/4.5/4.0/' Algorithm.VisualBasic/QuantConnect.Algorithm.VisualBasic.vbproj && \ +# wget https://nuget.org/nuget.exe && \ +# mono nuget.exe restore QuantConnect.Lean.sln -NonInteractive && \ +# xbuild /property:Configuration=Release && \ +# cd ~/Lean/Launcher/bin/Release/ +################################# + + +################################ +# Option 2: Run Local Binaries: +COPY ./Data ~/Lean/Data +COPY ./Launcher/bin/Release ~/Lean/Launcher/bin/Release +################################# + +# Finally. +WORKDIR ~/Lean/Launcher/bin/Release +CMD [ "mono", "QuantConnect.Lean.Launcher.exe"] # Run app + +# Usage: +# docker build -t lean:foundation -f DockerfileLeanFoundation . +# docker build -t lean:algorithm -f DockerfileLeanAlgorithm . +# docker run lean:algorithm \ No newline at end of file diff --git a/DockerfileLeanFoundation b/DockerfileLeanFoundation new file mode 100644 index 000000000000..6d543d3121d5 --- /dev/null +++ b/DockerfileLeanFoundation @@ -0,0 +1,52 @@ +# +# LEAN Foundation Docker Container November-2016 +# Cross platform deployment for multiple brokerages +# Intended to be used in conjunction with DockerfileLeanAlgorithm. This is just the foundation common OS+Dependencies required. +# + +# Use base system for cleaning up wayward processes +FROM phusion/baseimage:0.9.19 + +MAINTAINER QuantConnect + +# Use baseimage-docker's init system. +CMD ["/sbin/my_init"] + +# Install OS Packages: +# Misc tools for running IB inside a headless container. +RUN \ + apt-get update && \ + apt-get install -y dos2unix wget xvfb unzip curl libxrender1 libxtst6 libxi6 + +# Java for running IB inside container: +# https://github.com/dockerfile/java/blob/master/oracle-java8/Dockerfile +RUN \ + echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ + add-apt-repository -y ppa:webupd8team/java && \ + apt-get update && \ + apt-get install -y oracle-java8-installer && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/cache/oracle-jdk8-installer + +# Install IB Gateway: Installs to ~/Jts +RUN \ + wget http://data.quantconnect.com/interactive/ibgateway-latest-standalone-linux-x64-v960.2a.sh && \ + chmod +x ibgateway-latest-standalone-linux-x64-v960.2a.sh && \ + ./ibgateway-latest-standalone-linux-x64-v960.2a.sh -q && \ + rm ibgateway-latest-standalone-linux-x64-v960.2a.sh + +# Install IB Controller: Installs to ~/IBController +RUN \ + wget https://github.com/ib-controller/ib-controller/releases/download/3.2.0/IBController-3.2.0.zip && \ + unzip IBController-3.2.0.zip -d ~/IBController && \ + chmod -R +x ~/IBController && \ + rm IBController-3.2.0.zip + +# Mono C# for LEAN: +# From https://github.com/mono/docker/blob/master/4.6.1.5/ +RUN apt-get update && rm -rf /var/lib/apt/lists/* +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +RUN echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/4.6.1.5 main" > /etc/apt/sources.list.d/mono-xamarin.list \ + && apt-get update \ + && apt-get install -y binutils mono-complete ca-certificates-mono fsharp mono-vbnc nuget referenceassemblies-pcl \ + && rm -rf /var/lib/apt/lists/* /tmp/*