-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
DockerfileJupyter
52 lines (42 loc) · 2.21 KB
/
DockerfileJupyter
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
#
# LEAN Jupyter Docker Container 20190428
#
# Use base system for cleaning up wayward processes
ARG LEAN_TAG=latest
FROM quantconnect/lean:$LEAN_TAG
MAINTAINER QuantConnect <[email protected]>
# Install Tini
RUN if [ "$(uname -m)" = "aarch64" ]; then \
tini_binary="tini-arm64"; \
tini_sha256="07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81"; \
else \
tini_binary="tini-amd64"; \
tini_sha256="93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c"; \
fi && \
wget --quiet -O tini "https://github.com/krallin/tini/releases/download/v0.19.0/${tini_binary}" && \
echo "${tini_sha256} *tini" | sha256sum -c - && \
mv tini /usr/local/bin/tini && \
chmod +x /usr/local/bin/tini
# Install clr-loader for PythonNet
RUN pip install --no-cache-dir clr-loader==0.1.6
# Setting some environment variables
ENV WORK /Lean/Launcher/bin/Debug/
ENV PYTHONPATH=${WORK}:${PYTHONPATH}
# Link Python startup file to profile
RUN mkdir -p /root/.ipython/profile_default/startup/ && \
ln -s /Lean/Launcher/bin/Debug/start.py /root/.ipython/profile_default/startup/start.py
RUN find ${WORK} -type f -not -name '*.py*' -not -name '*.xml' -not -name '*.exe.config' -not -name '*.exe' -not -name '*.so' -not -name '*.dll' -not -name '*.ipynb' -not -name '*.csx' -not -name 'QuantConnect.Lean.Launcher.runtimeconfig.json' -not -name 'decimal.py' -delete
# Create initialize script
RUN echo "if [ ! -d \"${WORK}Notebooks\" ]; then mkdir ${WORK}Notebooks; fi && \
if [ ! -f \"${WORK}Notebooks/config.json\" ]; then echo '{ \"data-folder\": \"/home/Data/\", \
\"composer-dll-directory\": \"$WORK\", \"algorithm-language\": \"Python\", \
\"messaging-handler\": \"QuantConnect.Messaging.Messaging\", \"job-queue-handler\": \"QuantConnect.Queues.JobQueue\", \
\"api-handler\": \"QuantConnect.Api.Api\" }' > ${WORK}Notebooks/config.json; fi && \
echo \"Starting JupyterLab, access in your browser at localhost:8888\" && \
jupyter lab --ip='0.0.0.0' --port=8888 --no-browser --allow-root --notebook-dir=\"Notebooks\" --LabApp.token='' " \
> start.sh
RUN chmod -R 777 ${WORK}
EXPOSE 8888
WORKDIR $WORK
ENTRYPOINT [ "/usr/local/bin/tini", "--" ]
CMD ./start.sh