FROM rocker/r-base:latest # 设置工作目录 WORKDIR /code # 安装系统依赖 RUN apt-get update && apt-get install -y \ libcurl4-openssl-dev \ libssl-dev \ libxml2-dev \ libgdal-dev \ libgeos-dev \ libproj-dev \ libnetcdf-dev \ && rm -rf /var/lib/apt/lists/* # 安装 R 包 RUN R -e "install.packages('remotes')" \ && R -e "remotes::install_cran('shiny')" \ && R -e "remotes::install_cran('dplyr')" \ && R -e "remotes::install_cran('sf')" \ && R -e "remotes::install_cran('stringr')" \ && R -e "remotes::install_cran('leaflet')" # 复制应用代码 COPY . . # 设置容器启动命令 CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]