FROM rocker/r-ver

RUN groupadd shiny && useradd -r -m shiny -g shiny

RUN apt-get update \
  && apt-get install -y --no-install-recommends \
     pandoc \
     pandoc-citeproc \
     libcurl4-gnutls-dev \
     libcairo2-dev \
     libxt-dev \
     xtail \
     libssl-dev \
     libicu-dev \
     wget

RUN R -e "install.packages(c('dplyr', 'shiny', 'readxl','remotes','httpuv','shinythemes','DT','ggplot2','gridExtra','emmeans','officer'), repos = 'https://cran.rstudio.com/', method='wget')"
RUN R -e 'install.packages("factoextra")'
RUN R -e 'install.packages("officer")'
RUN R -e 'install.packages("car")'
RUN R -e 'install.packages("markdown")'
RUN R -e 'install.packages("plotly")'
RUN R -e 'install.packages("shinylogs")'

RUN mkdir -p /srv/shiny && \
    chown shiny:shiny /srv/shiny

COPY app.R /srv/shiny/app.R
COPY README.md /srv/shiny/README.md
COPY arbre1.png /srv/shiny/arbre1.png
COPY arbre2.png /srv/shiny/arbre2.png

EXPOSE 8080

USER shiny



CMD ["R", "-e", "shiny::runApp('/srv/shiny', host='0.0.0.0', port=8080, launch.browser = F)"]
