FROM renku/renkulab:renku0.10.2-r3.6.1-0.6.1

USER root

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    apt-utils \
    dirmngr \
    gpg-agent \
    less \
    libcurl4-openssl-dev \
    libxml2-dev \
    libz-dev \
    software-properties-common

USER ${NB_USER}

# install the R dependencies
COPY install.R /tmp/
RUN R -f /tmp/install.R

# install the python dependencies
COPY requirements.txt environment.yml /tmp/
RUN conda env update -q -f /tmp/environment.yml && \
    /opt/conda/bin/pip install --ignore-installed -r /tmp/requirements.txt && \
    jupyter labextension install --no-build @jupyter-voila/jupyterlab-preview && \
    jupyter labextension install --no-build @jupyter-widgets/jupyterlab-manager && \
    conda clean -y --all && \
    conda env export -n "root" && \
    jupyter lab build

# install our utilities package

COPY --chown=rstudio:rstudio src /code/src
RUN ln -s /code/src
RUN pip install -e src/covid-19/covid_19_dashboard