-
Notifications
You must be signed in to change notification settings - Fork 32
/
Dockerfile
55 lines (42 loc) · 2.15 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
FROM openjdk:8-jdk as builder
RUN apt-get update && apt-get install -y --no-install-recommends git
RUN mkdir /jgit-spark-connector
WORKDIR /jgit-spark-connector
COPY . /jgit-spark-connector
RUN ./sbt assembly
FROM srcd/jupyter-spark:5.2.1
RUN mkdir -p /opt/
# jgit-spark-connector jar location
ENV SPARK_DRIVER_EXTRA_CLASSPATH spark.driver.extraClassPath
ENV SPARK_EXECUTOR_EXTRA_CLASSPATH spark.executor.extraClassPath
ENV SRCD_JAR /opt/jars/jgit-spark-connector-uber.jar
# bblfsh endpoint variables
ENV SPARK_BBLFSH_HOST spark.tech.sourced.bblfsh.grpc.host
ENV BBLFSH_HOST bblfshd
ENV SPARK_BBLFSH_PORT spark.tech.sourced.bblfsh.grpc.port
ENV BBLFSH_PORT 9432
USER root
RUN apt-get update && \
apt-get install -y --no-install-suggests --no-install-recommends locales curl g++ libxml2-dev && \
apt-get clean && \
locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
COPY ./python /opt/python-jgit-spark-connector/
COPY ./_examples/notebooks/* /home/$NB_USER/
COPY --from=builder /jgit-spark-connector/target/jgit-spark-connector-uber.jar /opt/jars/
RUN echo "local" > /opt/python-jgit-spark-connector/version.txt \
&& pip install -e /opt/python-jgit-spark-connector/ \
&& pip install jupyter-spark \
&& jupyter serverextension enable --py jupyter_spark \
&& jupyter nbextension install --py jupyter_spark \
&& jupyter nbextension enable --py jupyter_spark \
&& jupyter nbextension enable --py widgetsnbextension
# Separate the config file in a different RUN creation as this may change more often
RUN echo "$SPARK_DRIVER_EXTRA_CLASSPATH $SRCD_JAR\n$SPARK_EXECUTOR_EXTRA_CLASSPATH $SRCD_JAR" >> /usr/local/spark/conf/spark-defaults.conf \
&& echo "$SPARK_BBLFSH_HOST $BBLFSH_HOST\n$SPARK_BBLFSH_PORT $BBLFSH_PORT" >> /usr/local/spark/conf/spark-defaults.conf
# Disable jupyter token
RUN mkdir -p /root/.jupyter && \
echo "c.NotebookApp.token = ''" > ~/.jupyter/jupyter_notebook_config.py && \
echo "c.NotebookApp.open_browser = False" >> ~/.jupyter/jupyter_notebook_config.py && \
echo "c.NotebookApp.notebook_dir = '/home'" >> ~/.jupyter/jupyter_notebook_config.py && \
echo "c.NotebookApp.port = 8080" >> ~/.jupyter/jupyter_notebook_config.py