Use jq instead of sed

(c) Copyright IBM Corp. 2016
This commit is contained in:
Peter Parente
2016-02-02 10:47:57 -05:00
parent 3e27c990e9
commit 232d6fc465
2 changed files with 14 additions and 4 deletions

View File

@@ -6,6 +6,9 @@ MAINTAINER Jupyter Project <jupyter@googlegroups.com>
USER root
# Util to help with kernel spec later
RUN apt-get -y update && apt-get -y install jq
# Spark dependencies
ENV APACHE_SPARK_VERSION 1.5.1
RUN apt-get -y update && \
@@ -58,5 +61,7 @@ RUN bash -c '. activate python2 && \
python -m ipykernel.kernelspec --prefix=$CONDA_DIR && \
. deactivate'
# Set PYSPARK_HOME in the python2 spec
RUN sed -i '$ d' $CONDA_DIR/share/jupyter/kernels/python2/kernel.json && \
echo ', "env": {"PYSPARK_PYTHON": "/opt/conda/envs/python2/bin/python"} }' >> $CONDA_DIR/share/jupyter/kernels/python2/kernel.json
RUN jq --arg v "$CONDA_DIR/envs/python2/bin/python" \
'.["env"]["PYSPARK_PYTHON"]=$v' \
$CONDA_DIR/share/jupyter/kernels/python2/kernel.json > /tmp/kernel.json && \
mv /tmp/kernel.json $CONDA_DIR/share/jupyter/kernels/python2/kernel.json