我正试图在我的闪亮docker容器中安装最新的闪亮包,这样我就可以利用moduleServer
函数现在是闪亮包的一部分。在日志中,我检查我可以看到,当容器没有问题地设置时,无论出于什么原因,当我运行当前的rocker/shiny
repo时,它安装了一个较旧的闪亮版本,特别是1.4.0.2版本,它没有moduleServer
功能。有人知道如何安装最新的闪亮包吗?
我试过:
install.packages("https://cran.r-project.org/src/contrib/Archive/shiny/shiny_1.6.0.tar.gz", repo=NULL, type="source")
但是随后得到关于缺少bsib
和cachem
和htmlTools
的错误,但是它们不会完全安装。例如:
install.packages('bslib')
Warning message:
package ‘bslib’ is not available (for R version 4.0.0)
我可以试着拉tar文件,但这似乎是错误的方式去做,所以好奇如果有人有任何提示。
Dockerfile如下:
FROM rocker/shiny-verse:4.0.0
RUN R -e "install.packages('devtools')"
R -e "install.packages(c('shiny', 'rmarkdown', 'shinydashboard', 'scales', 'DT', 'zoo', 'plotly', 'data.table','lubridate','Hmisc'))" &&
cp -R /usr/local/lib/R/site-library/shiny/examples/* /srv/shiny-server/ &&
chown shiny:shiny /var/lib/shiny-server
EXPOSE 3838
Docker-compose
version: '3.7'
services:
rstudio:
container_name: rstudio
restart: unless-stopped
build: rstudio/.
volumes:
- /Users/mac/Documents/git_projects/docker-rstudio/scripts_example:/home/rstudio//example_scripts
environment:
- TZ=America/New_York
- PASSWORD=${PASSWORD}
ports:
- 8888:8787
shiny:
container_name: shiny
restart: unless-stopped
build: shiny/.
ports:
- 8080:3838
在我这边找到了一个解决方法。修改Dockerfile如下:
FROM rocker/shiny-verse:4.0.0
RUN R -e "install.packages(c('rmarkdown', 'shinydashboard', 'scales', 'DT', 'zoo', 'plotly', 'data.table','lubridate','Hmisc'))" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/rappdirs_0.3.3.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/rlang_0.4.12.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/fastmap_1.1.0.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/htmltools_0.5.2.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/sass_0.4.0.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/jquerylib_0.1.4.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/bslib_0.3.1.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/cachem_1.0.6.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/rlang_0.4.12.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/fontawesome_0.2.2.tar.gz', repo=NULL, type='source')" &&
R -e "install.packages('https://cran.r-project.org/src/contrib/shiny_1.7.1.tar.gz', repo=NULL, type='source')" &&
cp -R /usr/local/lib/R/site-library/shiny/examples/* /srv/shiny-server/ &&
chown shiny:shiny /var/lib/shiny-server
EXPOSE 3838
#COPY shiny-server.sh /usr/bin/shiny-server.sh
#RUN chmod -R 755 /usr/bin/shiny-server.sh
#CMD ["/usr/bin/shiny-server.sh"]