Otolith commited on
Commit
15df441
·
verified ·
1 Parent(s): aacaeea

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -17
Dockerfile CHANGED
@@ -1,28 +1,29 @@
1
  FROM rocker/r-base:latest
2
 
3
- # Set the working directory inside the container
4
  WORKDIR /code
5
 
6
- # Install system dependencies required by R packages (sf, leaflet, etc.)
7
  RUN apt-get update && apt-get install -y \
8
- libcurl4-openssl-dev \ # For curl support in R
9
- libxml2-dev \ # For XML support, used by some R packages
10
- libgdal-dev \ # For geospatial data processing (needed by sf)
11
- libgeos-dev \ # For geometry processing (needed by sf)
12
- libproj-dev \ # For coordinate reference system (CRS) support (needed by sf)
13
- libnetcdf-dev \ # For NetCDF support (could be used by sf or other spatial packages)
14
- && rm -rf /var/lib/apt/lists/* # Clean up apt cache to reduce image size
 
15
 
16
- # Install R packages from CRAN using remotes (to avoid installation errors from install2.r)
17
  RUN R -e "install.packages('remotes')" \
18
- && R -e "remotes::install_cran('shiny')" \ # Install shiny package
19
- && R -e "remotes::install_cran('dplyr')" \ # Install dplyr package
20
- && R -e "remotes::install_cran('sf')" \ # Install sf package (geospatial)
21
- && R -e "remotes::install_cran('stringr')" \ # Install stringr package
22
- && R -e "remotes::install_cran('leaflet')" # Install leaflet package (for mapping)
23
 
24
- # Copy the application code into the container
25
  COPY . .
26
 
27
- # Set the default command to run the Shiny app on port 7860
28
  CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]
 
1
  FROM rocker/r-base:latest
2
 
3
+ # 设置工作目录
4
  WORKDIR /code
5
 
6
+ # 安装系统依赖
7
  RUN apt-get update && apt-get install -y \
8
+ libcurl4-openssl-dev \
9
+ libssl-dev \
10
+ libxml2-dev \
11
+ libgdal-dev \
12
+ libgeos-dev \
13
+ libproj-dev \
14
+ libnetcdf-dev \
15
+ && rm -rf /var/lib/apt/lists/*
16
 
17
+ # 安装 R
18
  RUN R -e "install.packages('remotes')" \
19
+ && R -e "remotes::install_cran('shiny')" \
20
+ && R -e "remotes::install_cran('dplyr')" \
21
+ && R -e "remotes::install_cran('sf')" \
22
+ && R -e "remotes::install_cran('stringr')" \
23
+ && R -e "remotes::install_cran('leaflet')"
24
 
25
+ # 复制应用代码
26
  COPY . .
27
 
28
+ # 设置容器启动命令
29
  CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]