FROM rocker/shiny:4.5.1

RUN apt-get update && apt-get install -y \
    libxml2-dev libssl-dev libcurl4-openssl-dev \
    libharfbuzz-dev libfribidi-dev libfreetype6-dev \
    libpng-dev libtiff5-dev libjpeg-dev \
    && rm -rf /var/lib/apt/lists/*

RUN R -e "install.packages(c('shiny', 'shinydashboard', 'remotes','readxl'), repos='https://cran.rstudio.com/',dependencies=TRUE)"
RUN echo 'options(radiant.shinyFiles = FALSE)' >> /usr/local/lib/R/etc/Rprofile.site
COPY . /srv/shiny-server/
COPY set_path.R /usr/local/lib/R/etc/Rprofile.site.d/00-radiant-path.R
RUN echo 'source("/srv/shiny-server/radiant.model/R/coxp.R")' >> /usr/local/lib/R/etc/Rprofile.site
Run echo 'load("/srv/shiny-server/data/test.state.rda")' >> /usr/local/lib/R/etc/Rprofile.site

# 安装所有模块
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.data',dependencies=TRUE, type='source', upgrade='never',force=TRUE)"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.basics',dependencies=TRUE, type='source', upgrade='never',force=TRUE)"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.model',dependencies=TRUE, type='source', upgrade='never',force=TRUE)"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.multivariate',dependencies=TRUE, type='source', upgrade='never',force=TRUE)"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.design',dependencies=TRUE, type='source', upgrade='never',force=TRUE)"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.quickgen',dependencies=TRUE, type='source', upgrade='never',force=TRUE)"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant-master',dependencies=TRUE, type='source', upgrade='never',force=TRUE)"

WORKDIR /data
CMD ["R", "-e", "radiant::radiant(host='0.0.0.0', port=3838)"]

#docker images | grep radiant 查看镜像
#sudo systemctl restart shinyproxy  重启proxy
#sudo vim /etc/shinyproxy/application.yml 修改配置文件
#docker build -t radiant:latest .   构建镜像