FROM rocker/rstudio:4.0.3

ENV RENV_VERSION 0.12.2
RUN apt-get update && apt-get install -y \
    libcurl4-openssl-dev \
    libsodium-dev
RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
RUN R -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')"

COPY sankeyPlot sankeyPlot
WORKDIR sankeyPlot

RUN R -e 'renv::restore()'
RUN R -e "webshot::install_phantomjs(force = TRUE)"

EXPOSE 8000

ENTRYPOINT ["Rscript", "run_api.R"]