forked from neelp-git/experiments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
151 lines (126 loc) · 5.91 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
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
#
# Aerospike Server Dockerfile
#
# http://github.com/aerospike/aerospike-server.docker
#
# This docker file is compatible with Aerospike Community Edition. It provides Java and Python environments and access to the Aerospike DB.
FROM jupyter/base-notebook:python-3.8.6
USER root
ENV AEROSPIKE_VERSION 5.6.0.5
ENV AEROSPIKE_SHA256 defa39f96d5068f69d1e4d187fa20d7f4095966c9eac80b1e1de30c15cd0c651
ENV LOGFILE /var/log/aerospike/aerospike.log
ARG NB_USER=jovyan
ARG NB_UID=1000
ENV USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /home/${NB_USER}
USER root
RUN chown -R ${NB_UID} ${HOME}
# BEGIN TEST
# timezone needs to be set before nodejs kernel
RUN ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
RUN sudo apt-get update\
&& sudo apt-get install build-essential -y\
&& sudo apt-get install git -y
# spark notebook
RUN mkdir /opt/spark-nb; cd /opt/spark-nb\
&& wget -qO- https://javadl.oracle.com/webapps/download/AutoDL?BundleId=245467_4d5417147a92418ea8b615e228bb6935 | tar -xvz\
&& wget -qO- https://archive.apache.org/dist/spark/spark-3.0.0/spark-3.0.0-bin-hadoop3.2.tgz | tar -xvz\
&& pip install findspark numpy pandas matplotlib sklearn\
&& wget https://docs.aerospike.com/artifacts/aerospike-spark/3.1.0/aerospike-spark-assembly-3.1.0.jar
# js kernel
RUN sudo apt-get install -y nodejs npm\
&& sudo npm install -g npm\
&& sudo npm cache clean -f\
&& sudo npm install -g n\
&& sudo n stable
# c# kernel
# c kernel
RUN pip install jupyter-c-kernel\
&& install_c_kernel
# go kernel
RUN wget -O go.tgz https://golang.org/dl/go1.17.3.linux-amd64.tar.gz\
&& tar -C /usr/local -xzf go.tgz
ENV PATH=$PATH:/usr/local/go/bin
ENV GO111MODULE=on
RUN go install github.com/gopherdata/[email protected]\
&& go get github.com/aerospike/aerospike-client-go/v5\
&& mkdir -p ~/.local/share/jupyter/kernels/gophernotes\
&& cd ~/.local/share/jupyter/kernels/gophernotes\
&& cp $(go env GOPATH)/pkg/mod/github.com/gopherdata/[email protected]/kernel/* "."\
&& sed "s_gophernotes_$(go env GOPATH)/bin/gophernotes_" <kernel.json.in >kernel.json
#fix dependencies
RUN cd $(go env GOPATH)/pkg/mod/github.com/aerospike/aerospike-client-go/[email protected]\
&& go get -u\
&& go mod tidy
RUN cd $(go env GOPATH)/pkg/mod/github.com/go-zeromq/[email protected]\
&& go get -u\
&& go mod tidy
RUN cd $(go env GOPATH)/pkg/mod/github.com/gopherdata/[email protected]\
&& go get -u\
&& go mod tidy
# END TEST
# install jupyter notebook extensions, and enable these extensions by default: table of content, collapsible headers, and scratchpad
RUN pip install jupyter_contrib_nbextensions\
&& jupyter contrib nbextension install --sys-prefix\
&& jupyter nbextension enable toc2/main --sys-prefix\
&& jupyter nbextension enable collapsible_headings/main --sys-prefix\
&& jupyter nbextension enable scratchpad/main --sys-prefix
RUN mkdir /var/run/aerospike\
&& apt-get update -y \
&& apt-get install software-properties-common dirmngr gpg-agent -y --no-install-recommends\
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 \
&& apt-add-repository 'deb http://repos.azulsystems.com/ubuntu stable main' \
&& apt-get install -y --no-install-recommends build-essential wget lua5.2 gettext-base libldap-dev curl unzip python python3-pip python3-dev python3 zulu-11\
&& wget "https://www.aerospike.com/artifacts/aerospike-server-enterprise/${AEROSPIKE_VERSION}/aerospike-server-enterprise-${AEROSPIKE_VERSION}-ubuntu20.04.tgz" -O aerospike-server.tgz \
&& echo "$AEROSPIKE_SHA256 *aerospike-server.tgz" | sha256sum -c - \
&& mkdir aerospike \
&& tar xzf aerospike-server.tgz --strip-components=1 -C aerospike \
&& dpkg -i aerospike/aerospike-server-*.deb \
&& dpkg -i aerospike/aerospike-tools-*.deb \
&& pip install --no-cache-dir aerospike\
&& pip install --no-cache-dir pymongo\
&& wget "https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip" -O ijava-kernel.zip\
&& unzip ijava-kernel.zip -d ijava-kernel \
&& python3 ijava-kernel/install.py --sys-prefix\
&& rm ijava-kernel.zip\
&& rm -rf aerospike-server.tgz aerospike /var/lib/apt/lists/* \
&& rm -rf /opt/aerospike/lib/java \
&& apt-get purge -y \
&& apt autoremove -y \
&& mkdir -p /var/log/aerospike
COPY aerospike /etc/init.d/
RUN usermod -a -G aerospike ${NB_USER}
# Add the Aerospike configuration specific to this dockerfile
COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf
COPY aerospike.conf /etc/aerospike/aerospike.conf
COPY features.conf /etc/aerospike/features.conf
RUN chown -R ${NB_UID} /etc/aerospike
RUN chown -R ${NB_UID} /opt/aerospike
RUN chown -R ${NB_UID} /var/log/aerospike
RUN chown -R ${NB_UID} /var/run/aerospike
#RUN fix-permissions /etc/aerospike/
#RUN fix-permissions /var/log/aerospike
COPY notebooks* /home/${NB_USER}/notebooks
RUN echo "Versions:" > /home/${NB_USER}/notebooks/README.md
RUN python -V >> /home/${NB_USER}/notebooks/README.md
RUN java -version 2>> /home/${NB_USER}/notebooks/README.md
RUN asd --version >> /home/${NB_USER}/notebooks/README.md
RUN echo -e "Aerospike Python Client `pip show aerospike|grep Version|sed -e 's/Version://g'`" >> /home/${NB_USER}/notebooks/README.md
RUN echo -e "Aerospike Java Client 5.0.0" >> /home/${NB_USER}/notebooks/README.md
COPY jupyter_notebook_config.py /home/${NB_USER}/
RUN fix-permissions /home/${NB_USER}/
# register js kernel
# these have to run near the end or else they error out
RUN npm install -g --unsafe-perm zeromq\
&& npm install -g --unsafe-perm ijavascript\
&& npm install express\
&& npm install aerospike\
&& ijsinstall --spec-path=full --working-dir=${HOME}
# I don't know why this has to be like this
# rather than overiding
COPY entrypoint.sh /usr/local/bin/start-notebook.sh
#I had to do this to get the container to launch, not sure what I was doing wrong
RUN chmod +x /usr/local/bin/start-notebook.sh
WORKDIR /home/${NB_USER}/notebooks
USER ${NB_USER}