FROM jupyter/minimal-notebook:latest

# Install simpy
RUN /opt/conda/bin/conda install sympy

# Install scipy
RUN /opt/conda/bin/conda install scipy

USER root

# Install Julia 0.6
RUN mkdir /opt/julia && \
		cd /opt/julia && \
		wget --quiet https://julialang-s3.julialang.org/bin/linux/x64/0.6/julia-0.6.4-linux-x86_64.tar.gz && \
		tar -xzf julia-0.6.4-linux-x86_64.tar.gz --directory . --strip-components=1 && \
		ln -s /opt/julia/bin/julia /usr/bin/julia && \
		julia --version

RUN mkdir /opt/bondgraphs

COPY test_bondgraphs.py /opt/bondgraphs/

# Install BondGraphTools and run test file (forces installation of dependencies)
RUN apt-get update -y && \
		apt-get install -y dvipng && \
		pip install BondGraphTools && \
		python3 /opt/bondgraphs/test_bondgraphs.py

# Copy local files to the remote notebooks
RUN mkdir /opt/notebooks

COPY 1-NewtonsLaws /opt/notebooks/1-NewtonsLaws
COPY 2-StationaryAction /opt/notebooks/2-StationaryAction
COPY 3-BondGraphs /opt/notebooks/3-BondGraphs

WORKDIR /opt/notebooks/

# Port
EXPOSE 8888

# Run Jupyter Notebook
CMD ["/opt/conda/bin/jupyter", "notebook", "--notebook-dir=/opt/notebooks", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]

# Uncomment to access command line on the docker container
CMD ["bash"]
# to start jupyter run: /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip=0.0.0.0 --port=8888 --no-browser --allow-root
