FROM relnet/base
# See https://askubuntu.com/questions/909277/avoiding-user-interaction-with-tzdata-when-installing-certbot-in-a-docker-contai
ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /relnet
ADD ./manager_environment.yml /relnet/manager_environment.yml

RUN conda env update --name relnet-cenv --file manager_environment.yml

RUN source activate relnet-cenv; python -m ipykernel install --user --name relnet --display-name "py3-relnet"

RUN apt-get update && apt-get install -y dvipng texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra cm-super

RUN source activate relnet-cenv; pip install --upgrade nbconvert # fix for 500 error when opening notebook, see https://stackoverflow.com/questions/36851746/jupyter-notebook-500-internal-server-error.

ENV PATH /opt/conda/envs/relnet-cenv/bin:$PATH
ENV LD_LIBRARY_PATH /usr/local/lib/:$LD_LIBRARY_PATH
ENV RELNET_DEVICE_PLACEMENT CPU

# ports for jupyter
EXPOSE 8888
CMD ["bash", "/relnet/docker/manager/start_manager.sh"]