forked from QuantConnect/Lean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileLeanFoundationARM
200 lines (181 loc) · 8.81 KB
/
DockerfileLeanFoundationARM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# This is a version of DockerfileLeanFoundation for ARM
# Some packages from the AMD image are excluded because they are not available on ARM or take too long to build
# Use base system for cleaning up wayward processes
FROM phusion/baseimage:focal-1.0.0
MAINTAINER QuantConnect <[email protected]>
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# Have to add env TZ=UTC. See https://github.com/dotnet/coreclr/issues/602
RUN env TZ=UTC
# Install OS Packages:
# Misc tools for running Python.NET and IB inside a headless container.
RUN add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update
RUN add-apt-repository ppa:apt-fast/stable && apt-get update && apt-get -y install apt-fast
RUN apt-get update && apt-fast install -y git libgtk2.0.0 cmake bzip2 curl unzip wget python3-pip python-opengl zlib1g-dev \
xvfb libxrender1 libxtst6 libxi6 libglib2.0-dev libopenmpi-dev libstdc++6 openmpi-bin \
r-base pandoc libcurl4-openssl-dev \
openjdk-8-jdk openjdk-8-jre bbe \
&& apt-fast clean && apt-get remove -y apt-fast && apt-get clean && apt-get autoclean && apt-get autoremove --purge -y \
&& rm -rf /var/lib/apt/lists/*
# Install IB Gateway: Installs to /root/ibgateway
# We update the install script so it doesn't use the bundled JVM
# The bundled JVM doesn't work on ARM64, so we update it to use the JVM installed in the previous command
RUN mkdir -p /root/ibgateway && \
wget https://cdn.quantconnect.com/interactive/ibgateway-latest-standalone-linux-x64.v10.12.2d.sh && \
java_patch_version=$(java -version 2>&1 | head -n 1 | cut -d'_' -f2 | cut -d'"' -f1) && \
bbe -e 's|# INSTALL4J_JAVA_HOME_OVERRIDE=|INSTALL4J_JAVA_HOME_OVERRIDE="/usr/lib/jvm/java-1.8.0-openjdk-arm64"|' -e "s|-lt \"152\"|-lt \"$java_patch_version\"|" -e "s|-gt \"152\"|-gt \"$java_patch_version\"|" ibgateway-latest-standalone-linux-x64.v10.12.2d.sh > ibgateway-stable-standalone-linux-custom-jvm.sh && \
chmod 777 ibgateway-stable-standalone-linux-custom-jvm.sh && \
./ibgateway-stable-standalone-linux-custom-jvm.sh -q -dir /root/ibgateway && \
rm ibgateway-latest-standalone-linux-x64.v10.12.2d.sh ibgateway-stable-standalone-linux-custom-jvm.sh && \
sed -i "s/-lt \"152\"/-lt \"$java_patch_version\"/" /root/ibgateway/ibgateway && \
sed -i "s/-gt \"152\"/-gt \"$java_patch_version\"/" /root/ibgateway/ibgateway
# Install dotnet 6 sdk & runtime
# The .deb packages don't support ARM, the install script does
ENV PATH="/root/.dotnet:${PATH}"
RUN wget https://dot.net/v1/dotnet-install.sh && \
chmod 777 dotnet-install.sh && \
./dotnet-install.sh -c 6.0 && \
rm dotnet-install.sh
ENV DOTNET_ROOT="/root/.dotnet"
# Set PythonDLL variable for PythonNet
ENV PYTHONNET_PYDLL="/opt/miniforge3/lib/libpython3.8.so"
# Install miniforge
# miniconda doesn't support ARM, so we use miniforge instead
ENV PATH="/opt/miniforge3/bin:${PATH}"
RUN wget -O Miniforge3.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh && \
bash Miniforge3.sh -b -p /opt/miniforge3 && \
rm Miniforge3.sh && \
conda config --append channels https://repo.anaconda.com/pkgs/main && \
conda install -y conda=4.10.3 && \
pip install --upgrade --no-cache-dir pip==22.2.2 && \
conda install -y python=3.8.13 && conda install -y -c conda-forge pip=22.2.2 && conda clean -y --all
# Avoid pip install read timeouts
ENV PIP_DEFAULT_TIMEOUT=120
# Install numpy first to avoid it not being resolved when installing libraries that depend on it next
RUN pip install --no-cache-dir numpy==1.22.4
# The list of packages in this image is shorter than the list in the AMD images
# This list only includes packages that can be installed within 2 minutes on ARM
RUN pip install --no-cache-dir \
cython==0.29.30 \
pandas==1.4.4 \
scipy==1.8.1 \
numpy==1.22.4 \
wrapt==1.14.1 \
astropy==5.1 \
beautifulsoup4==4.11.1 \
dill==0.3.5.1 \
jsonschema==4.9.1 \
msgpack==1.0.3 \
numba==0.56.0 \
xarray==2022.6.0 \
plotly==5.9.0 \
jupyterlab==3.4.4 \
docutils==0.19 \
keras==2.10.0 \
lightgbm==3.3.2 \
nltk==3.7 \
graphviz==0.8.4 \
cmdstanpy==1.0.4 \
copulae==0.7.7 \
featuretools==0.18.1 \
PuLP==2.6.0 \
rauth==0.7.3 \
scikit-multiflow==0.5.3 \
scikit-optimize==0.9.0 \
aesara==2.7.9 \
tweepy==4.10.0 \
PyWavelets==1.3.0 \
copulas==0.7.0 \
cufflinks==0.17.3 \
gym==0.23.1 \
ipywidgets==8.0.0rc1 \
deap==1.3.3 \
cvxpy==1.2.1 \
pykalman==0.9.5 \
pyro-ppl==1.8.2 \
sklearn-json==0.1.0 \
dtw-python==1.2.2 \
mxnet==1.9.1 \
gluonts==0.7.7 \
gplearn==0.4.2 \
jax==0.3.16 \
pennylane==0.25.1 \
mplfinance==0.12.9b1 \
hmmlearn==0.2.7 \
ta==0.10.1 \
seaborn==0.11.2 \
optuna==2.10.1 \
findiff==0.9.2 \
sktime==0.13.1 \
hyperopt==0.2.7 \
bayesian-optimization==1.2.0 \
rpy2==3.5.3 \
matplotlib==3.5.3 \
sdeint==0.3.0 \
pandas_market_calendars==3.5 \
ruptures==1.1.7 \
simpy==4.0.1 \
scikit-learn-extra==0.2.0 \
fastText==0.9.2 \
tigramite==5.0.0.1 \
h2o==3.36.1.4 \
prophet==1.1.1 \
Riskfolio-Lib==3.3.0 \
nbeats-pytorch==1.6.0 \
torch==1.12.1 \
torchvision==0.13.1 \
ax-platform==0.2.7.2 \
alphalens-reloaded==0.4.2 \
pyfolio-reloaded==0.9.4 \
altair==4.2.0 \
stellargraph==1.2.1 \
modin==0.15.3 \
persim==0.3.1 \
ripser==0.6.4 \
pydmd==0.4.0.post2209 \
EMD-signal==1.2.3 \
spacy==3.4.1 \
pandas-ta==0.3.14b \
pytorch-ignite==0.4.10 \
tensorly==0.7.0 \
mlxtend==0.20.0 \
shap==0.41.0 \
lime==0.2.0.1 \
mpmath==1.2.1 \
stockstats==0.4.1 \
QuantStats==0.0.59 \
hurst==0.0.5 \
numerapi==2.12.4 \
pymdptoolbox==4.0-b3 \
fuzzy-c-means==1.6.3 \
panel==0.14.0 \
hvplot==0.8.1 \
line-profiler==3.5.1 \
py-heat==0.0.6 \
py-heat-magic==0.0.2 \
bokeh==2.4.3 \
river==0.13.0 \
stumpy==1.11.1 \
pyvinecopulib==0.6.2
RUN conda install -y -c conda-forge \
openmpi=4.1.4 && conda clean -y --all
RUN python -m nltk.downloader -d /usr/share/nltk_data punkt && \
python -m nltk.downloader -d /usr/share/nltk_data vader_lexicon && \
python -m nltk.downloader -d /usr/share/nltk_data stopwords
# Install ppscore
RUN wget https://cdn.quantconnect.com/ppscore/ppscore-master-ce93fa3.zip && \
unzip -q ppscore-master-ce93fa3.zip && cd ppscore-master && \
pip install . && cd .. && rm -rf ppscore-master && rm ppscore-master-ce93fa3.zip
# Install DX Analytics
RUN wget https://cdn.quantconnect.com/dx/dx-master-69922c0.zip && \
unzip -q dx-master-69922c0.zip && cd dx-master && \
pip install . && cd .. && rm -rf dx-master && rm dx-master-69922c0.zip
# Due to conflicts install 'pomegranate' virtual environment package
RUN python -m venv /Foundation-Pomegranate --system-site-packages && . /Foundation-Pomegranate/bin/activate \
&& pip install --no-cache-dir \
pomegranate==0.14.8 \
&& python -m ipykernel install --name=Foundation-Pomegranate \
&& deactivate
RUN echo "{\"argv\":[\"python\",\"-m\",\"ipykernel_launcher\",\"-f\",\"{connection_file}\"],\"display_name\":\"Foundation-Py-Default\",\"language\":\"python\",\"metadata\":{\"debugger\":true}}" > /opt/miniforge3/share/jupyter/kernels/python3/kernel.json
# List all packages
RUN conda list