forked from scrtlabs/catalyst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
93 lines (79 loc) · 2.43 KB
/
Dockerfile
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
#
# Dockerfile for an image with the currently checked out version of catalyst installed. To build:
#
# docker build -t quantopian/catalyst .
#
# To run the container:
#
# docker run -v /path/to/your/notebooks:/projects -v ~/.catalyst:/root/.catalyst -p 8888:8888/tcp --name catalyst -it quantopian/catalyst
#
# To access Jupyter when running docker locally (you may need to add NAT rules):
#
# https://127.0.0.1
#
# Default password is 'jupyter'. To provide another, see:
# http://jupyter-notebook.readthedocs.org/en/latest/public_server.html#preparing-a-hashed-password
#
# Once generated, you can pass the new value via `docker run --env` the first time
# you start the container.
#
# You can also run an algo using the docker exec command. For example:
#
# docker exec -it catalyst catalyst run -f /projects/my_algo.py --start 2015-1-1 --end 2016-1-1 /projects/result.pickle
#
FROM python:3.5
#
# set up environment
#
ENV TINI_VERSION v0.10.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
ENV PROJECT_DIR=/projects \
NOTEBOOK_PORT=8888 \
SSL_CERT_PEM=/root/.jupyter/jupyter.pem \
SSL_CERT_KEY=/root/.jupyter/jupyter.key \
PW_HASH="u'sha1:31cb67870a35:1a2321318481f00b0efdf3d1f71af523d3ffc505'" \
CONFIG_PATH=/root/.jupyter/jupyter_notebook_config.py
#
# install TA-Lib and other prerequisites
#
RUN mkdir ${PROJECT_DIR} \
&& apt-get -y update \
&& apt-get -y install libfreetype6-dev libpng-dev libopenblas-dev liblapack-dev gfortran \
&& curl -L https://downloads.sourceforge.net/project/ta-lib/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz | tar xvz
#
# build and install catalyst from source. install TA-Lib after to ensure
# numpy is available.
#
WORKDIR /ta-lib
RUN pip install 'numpy>=1.11.1,<2.0.0' \
&& pip install 'scipy>=0.17.1,<1.0.0' \
&& pip install 'pandas>=0.18.1,<1.0.0' \
&& ./configure --prefix=/usr \
&& make \
&& make install \
&& pip install TA-Lib \
&& pip install matplotlib \
&& pip install jupyter
#
# This is then only file we need from source to remain in the
# image after build and install.
#
ADD ./etc/docker_cmd.sh /
#
# make port available. /catalyst is made a volume
# for developer testing.
#
EXPOSE ${NOTEBOOK_PORT}
#
# build and install the catalyst package into the image
#
ADD . /catalyst
WORKDIR /catalyst
RUN pip install -e .
#
# start the jupyter server
#
WORKDIR ${PROJECT_DIR}
CMD /docker_cmd.sh